Skip to content

Instantly share code, notes, and snippets.

@sethwololo
Created May 11, 2022 16:11
Show Gist options
  • Save sethwololo/5f92144552a1ce2ceaf174f360d7c4e4 to your computer and use it in GitHub Desktop.
Save sethwololo/5f92144552a1ce2ceaf174f360d7c4e4 to your computer and use it in GitHub Desktop.
Verify YouTube video existence with Python
import requests
def validateYoutube(self, youtube_id):
response = requests.head('https://img.youtube.com/vi/' + youtube_id + '/mqdefault.jpg')
if response.status_code == 200:
return True
else:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment