Python Scrapy Xpath选择器获胜';有些表达方式我不懂

Python Scrapy Xpath选择器获胜';有些表达方式我不懂,python,xpath,scrapy,Python,Xpath,Scrapy,当我使用scrapy shell(或运行爬虫程序)时,某些表达式似乎不起作用: scrapy shell http://www.abc.net.au/news/2017-02-17/climate-change-could-threaten-entire-financial-system-apra/8281436?section=business [s] Available Scrapy objects: [s] scrapy scrapy module (contains scra

当我使用scrapy shell(或运行爬虫程序)时,某些表达式似乎不起作用:

scrapy shell http://www.abc.net.au/news/2017-02-17/climate-change-could-threaten-entire-financial-system-apra/8281436?section=business
[s] Available Scrapy objects:
[s]   scrapy     scrapy module (contains scrapy.Request, scrapy.Selector, etc)
[s]   crawler ...
>>> from scrapy.selector import Selector
>>> # That's working:
>>> Selector(response).xpath('//div[@class="article section"]/h1/text()').extract()[0]
u'Climate change could threaten entire financial system, APRA warns'
>>> # But this is not:
>>> Selector(response).xpath('//p[@class="first"]/text()').extract()
[]

我做错了什么?Chromium开发工具能够找到XPath表达式,但我的Python脚本却找不到。

事实上,如果您在浏览器中打开网站,查看其源代码,或使用“wget”或“curl”下载其源代码,则找不到类为“first”的“p”标记


“first”class属性可以通过javascript附加到“p”标记上,因此您可以使用Chromium开发工具找到它。

事实上,如果您在浏览器中打开网站,查看其源代码,或者使用“wget”或“curl”下载其源代码,则无法找到以“first”作为其类的“p”标记

“first”class属性可以通过javascript附加到“p”标记上,因此您可以使用Chromium开发工具找到它