我正在尝试使用Scrapy下载一些与学校项目相关的内容。我想获得每个页面的关键词列表,然后将其存储在数据库中。这是我目前所拥有的。
scrapy shell http://news.nationalgeographic.com/2015/03/150318-pitcairn-marine-reserve-protected-area-ocean-conservation/
>>> response.xpath('//title/text()').extract()
[u'World\u2019s Largest Single Marine Reserve Created in Pacific']
>>> response.xpath("//meta[@name='keywords']")[0].extract()
u'<meta name="keywords" content="ocean life, conservationists, marine biodiversity, marine sanctuaries, wildlife conservation, marine protected areas, mpas, reserves, sanctuaries, ocean conservation">'
我想要做的就是从 name='keywords' 的 meta 标签中提取内容。
谢谢!