Created
May 21, 2014 04:33
-
-
Save nyov/2f8bcdd656b2ee785422 to your computer and use it in GitHub Desktop.
(scrapy) use a custom html string as new response body
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scrapy.http import HtmlResponse | |
def parse(self, response): | |
body = cc_stripped(response.body) # modifyor get new response.body | |
response = HtmlResponse(response.url, | |
encoding='utf-8', | |
body=body.decode('utf-8'), | |
) | |
sel = Selector(response) | |
[...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment