This commit is contained in:
2023-11-26 16:20:05 +01:00
parent 7452978f65
commit 10e190c673
3 changed files with 19 additions and 4 deletions

1
pagina.html Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,5 @@
import re import re
import os
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.ui import WebDriverWait
@@ -20,10 +21,11 @@ scripto=[]
#INPUT #INPUT
#prende l url della pagina justeat del ristorante in input #prende l url della pagina justeat del ristorante in input
#restaurant_url = input('link della pagina justeat del ristorante: ') print ("\nesempio: https://www.justeat.it/restaurants-pizzeria-la-garganica-bologna/menu")
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
@@ -169,3 +171,5 @@ html += "</body></html>"
# Salvataggio su file # Salvataggio su file
with open("pagina.html", "w") as file: with open("pagina.html", "w") as file:
file.write(html) file.write(html)
os.remove("JEmenu.html")

View File

@@ -1,7 +1,9 @@
#!/bin/bash #!/bin/bash
echo "Installo i moduli python necessari nella cartella .venv"
python -m venv .venv python -m venv .venv
source .venv/bin/activate source .venv/bin/activate
echo
pip3 install requests pip3 install requests
pip3 install BeautifulSoup4 pip3 install BeautifulSoup4
@@ -12,6 +14,14 @@ pip3 install selenium
#pip3 install cloudscraper #pip3 install cloudscraper
#pip3 install json #pip3 install json
echo "Installo chromium (se non già installato) necessario per lo scrape"
echo
sudo apt update
if [ -f /etc/os-release ] && grep -q "NAME=\"Ubuntu\"" /etc/os-release; then
sudo apt install chromium-browser -y
else
sudo apt install chromium -y
fi
echo echo
echo "Attiva il virtualenv: source .venv/bin/activate" echo "Attiva il virtualenv: source .venv/bin/activate"
echo "Poi lancia lo script: python3 scrapeje.py" echo "Poi lancia lo script: python3 scrapeje.py"