I
I
Igor Statkevich2019-02-10 14:13:31
Python
Igor Statkevich, 2019-02-10 14:13:31

How to parse javascript text from html?

I'm trying to parse data from the page, I request the page through requests, the data on the page is rendered by javascript, it's clear that you can use selenium and parse the data normally, but the data is present in the html body

<script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"SportsEvent","startDate":"2019-02-10T17:30:00+00:00","url":"https:\/\/www.protipster.com\/betting-tips\/paok-fc-olympiacos-fc\/15382744","name":"PAOK FC Vs Olympiacos FC","description":"PAOK FC vs Olympiacos FC predictions, betting tips and match previews 2019-02-10 17:30:00. Check the best Free betting tips and predictions from hundreds of successful tipsters for PAOK FC vs Olympiacos FC or post your own tips at Protipster and earn special prizes\n","location":{"@type":"Place","name":"Toumba Stadium","address":"Toumba Stadium"},"homeTeam":{"@type":"SportsTeam","name":"PAOK FC"},"awayTeam":{"@type":"SportsTeam","name":"Olympiacos FC"},"image":"https:\/\/ls.betradar.com\/ls\/crest\/big\/3251.png","endDate":"2019-02-10T19:30:00+00:00"}

how to pull out the data without rendering the page? use regular expressions to search for a substring in the html body and convert json, and then work like with a regular dictionary or is there some alternative (library / module)?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question