Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import json
  2. import re
  3. from bs4 import BeautifulSoup # $ pip install beautifulsoup4
  4.  
  5. html = //Your html output
  6. soup = BeautifulSoup(html)
  7. script = soup.find('script', text=re.compile('json1'))
  8. json_text = re.search(r'^s*json1s*=s*({.*?})s*;s*$',
  9. script.string, flags=re.DOTALL | re.MULTILINE).group(1)
  10. data = json.loads(json_text)
  11. print(data['json1'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement