Update 'ScrapeJE.py'

This commit is contained in:
2022-10-03 09:49:22 +02:00
parent c487629a63
commit ca27ba5b5a

View File

@@ -16,11 +16,11 @@ scraper = cloudscraper.create_scraper(browser={'browser': 'firefox','platform':
#page = scraper.get(linkJE).content #usa input manuale #page = scraper.get(linkJE).content #usa input manuale
page = scraper.get("https://www.justeat.it/restaurants-saporedialeppo/menu").content #usa input automatico page = scraper.get("https://www.justeat.it/restaurants-saporedialeppo/menu").content #usa input automatico
#crea il file html #crea il file html
with open('aleppo.html', 'wb') as f: with open('JEmenu.html', 'wb') as f:
f.write(page) f.write(page)
#apre e legge il file #apre e legge il file
with open('aleppo.html', 'rb') as f: with open('JEmenu.html', 'rb') as f:
page = f.read() page = f.read()
#parser #parser
@@ -90,7 +90,7 @@ print("lista prezzi:",len(prezzo)) #sono stringhe ovvero ci sono anche prezzi co
#Crea file json formattato per jawanndenn con la lista dei nomi dei prodotti #Crea file json formattato per jawanndenn con la lista dei nomi dei prodotti
with open('jwndn.json', 'w') as jw: with open('jwndn.json', 'w') as jw:
jw.write("{\n") jw.write("{\n")
jw.write(' "lifetime": "day",\n') jw.write(' "lifetime": "month",\n')
jw.write(' "equal_width": true,\n') jw.write(' "equal_width": true,\n')
jw.write(' "title":') jw.write(' "title":')
jw.write('"') jw.write('"')
@@ -114,8 +114,12 @@ with open('jwndn.json', 'a+') as jw:
# #
#storare in "tel" il numero di telefono dle ristorante #storare in "tel" il numero di telefono dle ristorante
#automatizzare l inserimento in jawandenn #automatizzare l inserimento in jawandenn
#PS jawanndenn include la funzione per argomento #PS jawanndenn include la funzione per argomento
#"jawanndenn --loaddata FILE.json" --> Load a JSON export of the database from FILE.json, then quit. #"jawanndenn --loaddata FILE.json" --> Load a JSON export of the database from FILE.json, then quit. #MA NON MI FUNZIONA!
#aggiungere la possibilità di mettere piu di un voto al doodle (ovvero prendere piu prodotti come es: 2 fatayer al formaggio)
#fare in modo che quando si passa il mouse sul nome del prodotto (nel doodle) compaiano descrizione, npezzi e prezzo #fare in modo che quando si passa il mouse sul nome del prodotto (nel doodle) compaiano descrizione, npezzi e prezzo
#forse per il prezzo trattamento diverso #forse per il prezzo trattamento diverso
# #