Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import re
- from bs4 import BeautifulSoup # $ pip install beautifulsoup4
- html = //Your html output
- soup = BeautifulSoup(html)
- script = soup.find('script', text=re.compile('json1'))
- json_text = re.search(r'^s*json1s*=s*({.*?})s*;s*$',
- script.string, flags=re.DOTALL | re.MULTILINE).group(1)
- data = json.loads(json_text)
- print(data['json1'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement