How to extract raw html from a Scrapy selector?

后端 未结 3 1465
孤城傲影
孤城傲影 2021-01-12 15:35

I\'m extracting js data using response.xpath(\'//*\')re_first() and later converting it to python native data. The problem is extract/re methods don\'t seem to provide a way

3条回答
  •  忘掉有多难
    2021-01-12 15:53

    You can also utilise the same function that is used by the Selector class' extract method, but with different arguments:

    from lxml import etree
    etree.tostring(selector._root)
    

提交回复
热议问题