[Solved] Extract data from span tag within a div tag


I would use the BeautifulSoup library. Here is how I would grap this info knowning that you already have the HTML file :

from bs4 import BeautifulSoup

with open(html_path) as html_file:
    html_page = BeautifulSoup(html_file, 'html.parser')
    div = html_page.find('div', class_='playbackTimeline__duration')
    span = div.find('span', {'aria-hidden': 'true'})
    text = span.get_text()

I’m not sure if it works, but it gives you an idea on how to do this kind of stuff. Check for “web scraping” if you want more information about that. 🙂

solved Extract data from span tag within a div tag