我试图刮掉,可以在这里找到,从表中的数据(使用scrapy):遇到问题选择某些特定的XPath ...(HTML表格,scrapy,XPath的)
http://www.bettingtools.co.uk/tipster-table/tipsters
我的蜘蛛当我分析下面的XPath内响应函数:
//*[@id="imagetable"]/tbody/tr
页面共享该ID,所以我基本上抢占了所有表数据的每个表。
但是,我只想要当前月份的表格数据(右栏中的表格)。
当我尝试并更具体地使用我的xpath时,即使它看起来是正确的,我也会得到无效的xpath错误。我已经试过:
- //*[@id="content"]/[contains(@class, "column2")]/[contains(@class, "table3")]/[@id="imagetable"]/tbody/tr
- //*[@id="content"]/div[contains(@class, "column2")]/div[contains(@class, "table3")]/[@id="imagetable"]/tbody/tr
- //*[@id="content"]/div[2]/div[1]/[@id="imagetable"]/tbody/tr
此外,当我尽量选择镀铬的页面上的特定表中的XPath我只是得到//*[@id="imagetable"].
我失去的东西在这里很明显?为什么我尝试的3个以上xpath示例无效?
由于
谢谢,这工作。任何想法,我的地方出错了? – preach