Created
February 13, 2020 16:21
-
-
Save OldMetalmind/ac7767a4f526508d273c91b338090370 to your computer and use it in GitHub Desktop.
Grab JSON from source
This file contains 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
# Core | |
import time | |
import json | |
# Third-party | |
import requests | |
from bs4 import BeautifulSoup | |
SOURCE = requests.get("<ENDPOINT>") | |
soup = BeautifulSoup(SOURCE.text, "html.parser") | |
all_scripts = soup.find_all('script') | |
script_with_data = all_scripts[22] | |
raw_data = script_with_data.get_text()[2638:22084] | |
data = json.loads(raw_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment