Created
January 10, 2018 03:58
-
-
Save AlJohri/0ff2570ecf2e3316ec7c9dead6d78ee7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python2 | |
| import re | |
| import json | |
| import requests | |
| import execjs | |
| response = requests.get("https://obamawhitehouse.archives.gov/interactive-budget") | |
| m = re.search(r"//init data(.*)//init TreeMap", response.text, re.S) | |
| js = m.groups()[0].replace('var json = ', '').replace(';', '') | |
| data = execjs.eval(js) | |
| with open('input.json', 'w') as f: | |
| json.dump(data, f, indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment