我刮http://stats.espncricinfo.com/ci/engine/records/index.html?id=2;type=teamXPath表达式中scrapy返回空列表
我确实需要连接到XPath表达式
/html/body/div[1]/div[3]/div[4]/table/tbody/tr/td[1]/div[2]/table[1]/tbody/tr/td/ul[2]/li/a[2]
在页面中的链接是列表下方打上了"One-day Internationals"
元素的比赛结果的年份。上述表达式是使用Firefox扩展Firebug获得的。
但它返回一个空列表。已尝试使用替代xpath表达式,如
//div[@id="ciHomeContentlhs"]/table/tbody/tr/td[1]/div/table[2]/tbody/tr/td/ul/li/a[2]/@href
具有相同的结果。
XPath表达式
//div[@id="ciHomeContentlhs"]/table
是给我的表。但是,
//div[@id="ciHomeContentlhs"]/table/tbody
正在返回一个空列表。我已经在 http://videlibri.sourceforge.net/cgi-bin/xidelcgi上测试了xpath表达式,并将所需的href
或节点显示为输出。我似乎无法在Python
中工作。
啊!谢谢。我想出了一个解决方法,但不知道为什么我不能。 – Vishnu