update
This commit is contained in:
1
pagina.html
Normal file
1
pagina.html
Normal file
File diff suppressed because one or more lines are too long
10
scrapeje.py
10
scrapeje.py
@@ -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
|
||||||
@@ -168,4 +170,6 @@ 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")
|
||||||
12
setup.sh
12
setup.sh
@@ -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,7 +14,15 @@ 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"
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user