Use requests.get(url).json() instead of importing the json module

This commit is contained in:
Benjamin Loison 2023-05-15 23:10:45 +02:00
parent e0e72866a2
commit 08a9880a58
No known key found for this signature in database

View File

@ -1,14 +1,13 @@
#!/usr/bin/python3
import requests, json, os, re
import requests, os, re
def getContentFromURL(url):
if API_KEY != '':
url = f'https://www.googleapis.com/youtube/v3/{url}&key={API_KEY}'
else:
url = f'https://yt.lemnoslife.com/noKey/{url}'
content = requests.get(url).text
data = json.loads(content)
data = requests.get(url).json()
return data
VIDEO_ID = input('Video id: ')