In the html code, Vine has <script type="application/ld+json"> with links to all the videos on the page, how would I got about accessing this JSON?
import requests
from bs4 import BeautifulSoup
url = 'https://vine.co/tags/funny'
source_code = requests.get(url)
plain_text = source_code.text
soup = BeautifulSoup(plain_text, 'html.parser')
You can use a css selector:
Or find_all setting
type="application/ld+json":Both gives you:
To get it into json, all you need is to json.loads the text, also since there is only one, you can use select_one or find:
Which gives you:
The last step is just to parse js to get the urls, they are in a list of dicts you can access with
js["itemListElement"]: