小编ash*_*win的帖子

如何将 Scrapy XPath 与 XML 命名空间一起使用?

如何<content:encoded> ... </content:encoded>使用scrapy XPath 从RSS 提要中提取内容(示例如下)?

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Latest &#8211; Reason.com</title>
    <item>
        <pubDate>Thu, 16 Jan 2020 21:40:23 +0000</pubDate>
        <content:encoded><![CDATA[<p><span style="font-weight: 400">
          Jimmy Meders was scheduled to die by lethal injection today, 
          but the Georgia parole board has granted him clemency.</span></p>]]> 
        </content:encoded>
...
Run Code Online (Sandbox Code Playgroud)

我试过了response.xpath('//content:encoded').get(),但它不起作用。

任何帮助都受到高度赞赏。

html xml xpath xml-namespaces scrapy

3
推荐指数
1
解决办法
292
查看次数

标签 统计

html ×1

scrapy ×1

xml ×1

xml-namespaces ×1

xpath ×1