From 64c4dd48d3f63fdb84a60a988ed2b187c53b3065 Mon Sep 17 00:00:00 2001 From: scossa Date: Sat, 1 Oct 2022 03:28:54 +0200 Subject: [PATCH] Update 'ScrapeJE.py' --- ScrapeJE.py | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/ScrapeJE.py b/ScrapeJE.py index 86bfd48..d642dc6 100644 --- a/ScrapeJE.py +++ b/ScrapeJE.py @@ -8,17 +8,21 @@ npezzi=[] prezzo=[] n=0 -linkJE = input('Incolla il link del ristorante: ') -linkJE +#prende l url della pagina justeat del ristorante in input +linkJE = input('link della pagina justeat del ristorante: ') + #scrape html scraper = cloudscraper.create_scraper(browser={'browser': 'firefox','platform': 'windows','mobile': False}) page = scraper.get(linkJE).content +#crea il file html with open('aleppo.html', 'wb') as f: f.write(page) +#apre e legge il file with open('aleppo.html', 'rb') as f: page = f.read() +#parser soup = BeautifulSoup(page, "html.parser") menu = soup.find(attrs={"data-test-id": "menu-item"}) @@ -27,8 +31,15 @@ menu = soup.find(attrs={"data-test-id": "menu-item"}) nrist=soup.title.text[8:-32] menu.find(attrs={"allergenPhoneNumber": "menu-item-name"}) -# alla riga 870 dell html c'è "allergenPhoneNumber":"3389529446" +## +#Stora il numero di telfono del ristorante +#info-> alla riga 870 dell html, all interno di uno