Scraping text with xpath/lxml

Viewed 314

I'm trying to scrape the text "2005-2013" from the text that says "drink between: 2005 - 2013" from http://www.cellartracker.com/wine.asp?iWine=91411 using xpath/lxml, and am only able to do it for some of the other pages on this site, and not this one. Not sure what I'm doing wrong/if the xpath I have been copying from the element is incorrect

it tell's me:

print(content_divs[0].text_content().strip())
IndexError: list index out of range

Here's my code:

import requests, lxml.html
page = requests.get('http://www.cellartracker.com/wine.asp?iWine=91411')
html = lxml.html.fromstring(page.content)
content_divs = html.xpath('//*[@id="wine_copy_inner"]/p/a[4]')
print(content_divs[0].text_content().strip())

thanks for your help!!!

2 Answers
Related