Search code examples
pythonbeautifulsouphtml-parsing

Parsing date with BeautifulSoup


I'm getting info from a page with BeautifulSoup and I obtained the link:

[<span class="field-content">Friday, September 11, 2015</span>]

with the commands

links = soup.find_all('div', attrs={'class':'views-row'})
link = links[0]
link.find('span', attrs={'class':'views-field views-field-created'}).select('span')

but I need to parse the date. How can I get Friday, September 11, 2015 out of this?


Solution

  • I've found it, it's link.find('span', attrs={'class':'views-field views-field-created'}).select_one('span').text