Use requests.get(url).json()
instead of import
ing the json
module
This commit is contained in:
parent
e0e72866a2
commit
08a9880a58
@ -1,14 +1,13 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import requests, json, os, re
|
import requests, os, re
|
||||||
|
|
||||||
def getContentFromURL(url):
|
def getContentFromURL(url):
|
||||||
if API_KEY != '':
|
if API_KEY != '':
|
||||||
url = f'https://www.googleapis.com/youtube/v3/{url}&key={API_KEY}'
|
url = f'https://www.googleapis.com/youtube/v3/{url}&key={API_KEY}'
|
||||||
else:
|
else:
|
||||||
url = f'https://yt.lemnoslife.com/noKey/{url}'
|
url = f'https://yt.lemnoslife.com/noKey/{url}'
|
||||||
content = requests.get(url).text
|
data = requests.get(url).json()
|
||||||
data = json.loads(content)
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
VIDEO_ID = input('Video id: ')
|
VIDEO_ID = input('Video id: ')
|
||||||
|
Reference in New Issue
Block a user