1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 21:44:21 +00:00

fix single video playlists

This commit is contained in:
Steffo 2018-02-28 17:05:45 +01:00
parent a4078dd336
commit 668595908b
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: C27544372FBB445D

View file

@ -52,6 +52,8 @@ class Video:
# Retrieve info before downloading # Retrieve info before downloading
with youtube_dl.YoutubeDL() as ytdl: with youtube_dl.YoutubeDL() as ytdl:
info = await loop.run_in_executor(executor, functools.partial(ytdl.extract_info, self.ytdl_url, download=False)) info = await loop.run_in_executor(executor, functools.partial(ytdl.extract_info, self.ytdl_url, download=False))
if "entries" in info:
info = info["entries"][0]
file_id = info.get("title", str(hash(self.ytdl_url))) file_id = info.get("title", str(hash(self.ytdl_url)))
file_id = re.sub(r"(?:\/|\\|\?|\*|\"|<|>|\||:)", "_", file_id) file_id = re.sub(r"(?:\/|\\|\?|\*|\"|<|>|\||:)", "_", file_id)
if os.path.exists(f"opusfiles/{file_id}.opus"): if os.path.exists(f"opusfiles/{file_id}.opus"):