I checked similar questions, but could not find a solution...
I'm trying to scrape the minutes of extra travel time (46) from the following page: https://www.tomtom.com/en_gb/trafficindex/city/istanbul
I've tried by 2 methods (Xpath & find class), but both give an empty return.
import requests
from bs4 import BeautifulSoup
from lxml.html import fromstring
page = requests.get("https://www.tomtom.com/en_gb/trafficindex/city/istanbul")
tree = fromstring(page.content)
soup = BeautifulSoup(page.content, 'html.parser')
#print([type(item) for item in list(soup.children)])
html = list(soup.children)[2]
g_data = soup.find_all("div", {"class_": "big.ng-binding"})
congestion = tree.xpath("/html/body/div/div[2]/div[2]/div[2]/section[2]/div/div[2]/div/div[2]/div/div[2]/div[1]/div[1]/text()")
print(congestion)
print(len(g_data))
Am I missing something obvious?
Many thanks for helping out!