parsel

How to extract raw html from a Scrapy selector?

你说的曾经没有我的故事 提交于 2019-12-30 09:40:54
问题 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 to not unquote html i.e. original html: {my_fields:['O'Connor Park'], } extract output: {my_fields:['O'Connor Park'], } turning this output into json won't work. What's the easiest way around it? 回答1: Short answer: Scrapy/Parsel selectors' .re() and .re_first() methods replace HTML entities (except < , & ) instead, use