Fix metadata fetch logic issues and typos

This commit is contained in:
Peder Bergebakken Sundt 2019-03-13 11:25:08 +01:00
parent 9abbebedb0
commit 1440c5bdb6
1 changed files with 2 additions and 2 deletions

View File

@ -29,10 +29,10 @@ def filter_query_params(url, allowed=[]):
def get_youtube_dl_metadata(url, ydl = youtube_dl.YoutubeDL()):
if urlsplit(url).scheme == "":
return None
if urlsplit(url).netloc.lower() in ("www.youtube.com", "youtube.com", "youtub.be"):
if urlsplit(url).netloc.lower() in ("www.youtube.com", "youtube.com", "youtu.be"):
#Stop it from doing the whole playlist
url = filter_query_params(url, allowed=["v"])
if urlsplit(url).scheme == "ytdl":
elif urlsplit(url).scheme == "ytdl":
url = f"https://youtube.com/watch?v={urlsplit(url).netloc}"
try: