Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```
- save content from https://pastebin.com/cu4dHdtG to js_source.html. Then run
- scrapy shell ./js_source.html
- Code issued at '5.5"</p>', when re.compile run, it did converted to '5.5"</p>'
- ```
- import re
- import json
- pattern = re.compile(r"\"fields\": {.*?}}\W+},\W+\"", re.MULTILINE | re.DOTALL)
- json_source = response.xpath("//script[contains(., 'app.run({')]/text()").re(pattern)[0].replace(',\n "', '').replace('}\n }', '}').replace('"fields": ', '')
- json_data = json.loads(json_source)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement