Initial commit
This commit is contained in:
commit
f50c8e5fdc
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.idea
|
||||
|
20
scraper.py
Executable file
20
scraper.py
Executable file
|
@ -0,0 +1,20 @@
|
|||
#! /usr/bin/env python
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
headers = requests.utils.default_headers()
|
||||
headers.update({"User-Agent": "Mozilla/5.0"})
|
||||
|
||||
data = {
|
||||
'codiceStazione': 'S01700Milano+Centrale',
|
||||
'lang': 'IT',
|
||||
}
|
||||
|
||||
r = requests.post('http://viaggiatreno.it/vt_pax_internet/mobile/stazione', headers=headers, data=data)
|
||||
|
||||
print(r.text.encode('utf-8'))
|
||||
soup = BeautifulSoup(r.text, 'html.parser')
|
||||
treni = soup.find_all("div", class_="bloccorisultato")
|
||||
|
||||
for treno in treni:
|
||||
print(treno)
|
Loading…
Reference in New Issue
Block a user