I am working with lxml and requests to scrape data for a language development program for some of my friends who want to learn English . So i am currently working with the slang learning part of the program , I'll just skip to the main problem now.
Here is a sample page which i am using to demonstrate my problem.
import requests
from lxml import html
def make_tree(url):
headers = {'User-Agent':'Mozilla/5.0'}
page = requests.post(url,headers=headers)
return html.fromstring(page.text)
url = 'http://www.englishdaily626.com/slang.php?054'
t = make_tree(url)
print t.xpath('/html/body/p/table/tbody/tr/td/table[4]/tbody/tr[3]/td[2]/table/tbody/tr/td[2]/div/table/tbody/tr[2]/td[2]/p/span/text()')
this just gives me a blank list . My xpath is correct if checked in xpath viewer firefox. what is the problem then ? and is occuring everywhere expect for href .
` nodes in it and the first `
` definitely has a `
` tags at level 3. My browser says there are five `
` tags and one `
– Marcus Rickert Nov 24 '13 at 18:21