How To Extract Data From Javascript In A Json Format?
I am getting a hardtime extracting the data First I need to extract the title post and the posted date of the post here's the url. URL: https://cheddar.com/media/safety-concerns-ov
Solution 1:
Try to get data in this way:
txt = response.xpath("//script[contains(., 'window.__RELAY_STORE__')]/text()").re_first('window.__RELAY_STORE__ = (.*);')
This will crop name of js-variable and last ;
. So then when I call json.loads(txt)
it gives me valid json.
Post a Comment for "How To Extract Data From Javascript In A Json Format?"