Update 'ScrapeJE.py'

This commit is contained in:
2022-10-02 17:55:49 +02:00
parent dc0082cf6c
commit c487629a63

View File

@@ -1,6 +1,7 @@
import requests import requests
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
import cloudscraper import cloudscraper
import json
nome=[] nome=[]
desc=[] desc=[]
@@ -80,15 +81,41 @@ for x in range(len(nome)):
print("\n") print("\n")
print(nrist) print(nrist)
#print(tel) #print(tel)
print("lista nome",len(nome),) print("lista nome",len(nome))
print("lista desc:",len(desc)) print("lista desc:",len(desc))
print("lista npezzi:",len(npezzi)) print("lista npezzi:",len(npezzi))
print("lista prezzi:",len(prezzo)) #sono stringhe ovvero ci sono anche prezzi come "da 1,00 €" (servirà formattarla in double per poter fare i conti a fine doodle) print("lista prezzi:",len(prezzo)) #sono stringhe ovvero ci sono anche prezzi come "da 1,00 €" (servirà formattarla in double per poter fare i conti a fine doodle)
#Crea file json formattato per jawanndenn con la lista dei nomi dei prodotti
with open('jwndn.json', 'w') as jw:
jw.write("{\n")
jw.write(' "lifetime": "day",\n')
jw.write(' "equal_width": true,\n')
jw.write(' "title":')
jw.write('"')
jw.write(nrist)
jw.write('",')
jw.write("\n")
jw.write(' "options": \n')
def writeListJSONFile(filepathname, lista):
with open('./jwndn.json', 'a+') as f:
json.dump(nome, f)
writeListJSONFile('./jwndn.json', nome)
with open('jwndn.json', 'a+') as jw:
jw.write("\n}\n")
# #
#Creare un file json formattato per jawanndenn #storare in "tel" il numero di telefono dle ristorante
#automatizzare l inserimento in jawandenn #automatizzare l inserimento in jawandenn
#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.
#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
# #