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=[]
npezzi=[]
prezzo=[]
#prezzof=[]
prezzoN=[]
scripto=[]
@@ -23,25 +22,25 @@ scripto=[]
#INPUT
#prende l url della pagina justeat del ristorante in input
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
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
# driver = webdriver.Chrome()
# driver.get(restaurant_url)
driver = webdriver.Chrome()
driver.get(restaurant_url)
# wait = WebDriverWait(driver, 10)
# wait.until(EC.presence_of_element_located((By.CLASS_NAME, "c-menuItems-price--offline")))
wait = WebDriverWait(driver, 10)
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:
# f.write(page)
with open('JEmenu.html', 'w') as f:
f.write(page)
#apre e legge il file
apre e legge il file
with open('JEmenu.html', 'r') as f:
page = f.read()
@@ -191,4 +190,4 @@ html += "</body></html>"
with open("pagina.html", "w") as file:
file.write(html)
#os.remove("JEmenu.html")
os.remove("JEmenu.html")