itec78 1 year ago
parent
commit
441e6d57f6
1 changed files with 8 additions and 7 deletions
  1. 8 7
      alepposcraper.py

+ 8 - 7
alepposcraper.py

@@ -2,17 +2,18 @@
 
 from bs4 import BeautifulSoup
 import cloudscraper
+import requests
 
 def AleppoScraper():
-
+    url = "https://www.justeat.it/restaurants-saporedialeppo/menu"
+    
     scraper = cloudscraper.create_scraper(browser={'browser': 'firefox','platform': 'windows','mobile': False})
-    page = scraper.get("https://www.justeat.it/restaurants-saporedialeppo/menu").content
-    # with open('aleppo.html', 'wb') as f:
-    #     f.write(page)
+    page = scraper.get(url).content
 
-    # scraper = cloudscraper.create_scraper(browser={'browser': 'firefox','platform': 'windows','mobile': False})
-    # page = scraper.get("https://www.justeat.it/restaurants-bar-new-bridge-bologna/menu").content
-    # with open('pandabao.html', 'wb') as f:
+    # headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
+    # page = requests.get(url, headers=headers).content
+
+    # with open('aleppo.html', 'wb') as f:
     #     f.write(page)
 
     # with open('aleppo.html', 'rb') as f: