From d3dc65a4faa7736877eb93bb1de757c0b226cf68 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Sat, 6 Apr 2019 18:48:47 +0200 Subject: [PATCH] pls --- server/nightr/strategies/just_eat.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/server/nightr/strategies/just_eat.py b/server/nightr/strategies/just_eat.py index 64ac646..eba6193 100644 --- a/server/nightr/strategies/just_eat.py +++ b/server/nightr/strategies/just_eat.py @@ -1,11 +1,17 @@ import requests from bs4 import BeautifulSoup +from datetime import datetime, timedelta +import requests_cache + +requests_cache.install_cache("requests_cache", expire_after=timedelta(minutes=10)) def is_restaurant_open(name): - r = requests.get("https://www.just-eat.dk/area/8000-%C3%A5rhusc") + headers = { + 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'} + r = requests.get("https://www.just-eat.dk/area/8000-århusc") soup = BeautifulSoup(r.content, features='html5lib') + print(soup.prettify()) + print(soup.find('div', {'class': 'listing-group'})) - print(soup.find('div', {'data-test-id': 'listingGroupOpen'})) - -is_restaurant_open("stop2shop") \ No newline at end of file +is_restaurant_open("lel") \ No newline at end of file