Update scrapeje.py

This commit is contained in:
2023-11-26 19:15:55 +01:00
parent 8d776b81c5
commit c26454e02a

View File

@@ -15,7 +15,6 @@ nome=[]
desc=[] desc=[]
npezzi=[] npezzi=[]
prezzo=[] prezzo=[]
#prezzof=[]
prezzoN=[] prezzoN=[]
scripto=[] scripto=[]
@@ -23,25 +22,25 @@ scripto=[]
#INPUT #INPUT
#prende l url della pagina justeat del ristorante in input #prende l url della pagina justeat del ristorante in input
print ("\nesempio: https://www.justeat.it/restaurants-pizzeria-la-garganica-bologna/menu") print ("\nesempio: https://www.justeat.it/restaurants-pizzeria-la-garganica-bologna/menu")
#restaurant_url = input('INSERISCI IL LINK DELLA PAGINA DEL RISTORANTE: ') restaurant_url = input('INSERISCI IL LINK DELLA PAGINA DEL RISTORANTE: ')
#PER DEBUG #PER DEBUG
restaurant_url = 'https://www.justeat.it/restaurants-pizzeria-la-garganica-bologna/menu' #restaurant_url = 'https://www.justeat.it/restaurants-pizzeria-la-garganica-bologna/menu'
#INIZIALLIZZO PARSER #INIZIALLIZZO PARSER
# driver = webdriver.Chrome() driver = webdriver.Chrome()
# driver.get(restaurant_url) driver.get(restaurant_url)
# wait = WebDriverWait(driver, 10) wait = WebDriverWait(driver, 10)
# wait.until(EC.presence_of_element_located((By.CLASS_NAME, "c-menuItems-price--offline"))) wait.until(EC.presence_of_element_located((By.CLASS_NAME, "c-menuItems-price--offline")))
# page = driver.page_source page = driver.page_source
# with open('JEmenu.html', 'w') as f: with open('JEmenu.html', 'w') as f:
# f.write(page) f.write(page)
#apre e legge il file apre e legge il file
with open('JEmenu.html', 'r') as f: with open('JEmenu.html', 'r') as f:
page = f.read() page = f.read()
@@ -191,4 +190,4 @@ html += "</body></html>"
with open("pagina.html", "w") as file: with open("pagina.html", "w") as file:
file.write(html) file.write(html)
#os.remove("JEmenu.html") os.remove("JEmenu.html")