I am developing a project, where user submits a URL. I need to check if that URL is valid url , to download data from youtube-dl supported sites.
Please help.
Try this function:
import youtube-dl
url = 'type your url here'
def is_supported(url):
extractors = youtube_dl.extractor.gen_extractors()
for e in extractors:
if e.suitable(url) and e.IE_NAME != 'generic':
return True
return False
print (is_supported(url))
Remember: you need to import youtube_dl