Showing
1 changed file
with
13 additions
and
0 deletions
web/backend/yt8m/esot3ria/url_generator.py
0 → 100644
1 | +import requests | ||
2 | + | ||
3 | +base_URL = 'https://data.yt8m.org/2/j/i/' | ||
4 | +youtube_url = 'https://www.youtube.com/watch?v=' | ||
5 | + | ||
6 | +def getURL(vid_id): | ||
7 | + URL = base_URL + vid_id[:-2] + '/' + vid_id + '.js' | ||
8 | + response = requests.get(URL, verify = False) | ||
9 | + if response.status_code == 200: | ||
10 | + return youtube_url + response.text[10:-3] | ||
11 | + | ||
12 | + | ||
13 | +# example usage : getURL('nXSc'); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment