From: James Bunton Date: Mon, 5 Aug 2019 00:07:11 +0000 (+1000) Subject: Fix for Google metadata changes to find title X-Git-Url: https://code.delx.au/youtube-cgi/commitdiff_plain/7ee672be8998bfa85a8552f0e9c129d241e11f50 Fix for Google metadata changes to find title --- diff --git a/youtube.cgi b/youtube.cgi index 9e14fd1..ef7b608 100755 --- a/youtube.cgi +++ b/youtube.cgi @@ -292,8 +292,13 @@ def get_video_url(page): if not video_url: return None, None - filename = sanitize_filename(player_config["args"]["title"]) - filename += "." + extension + title = player_config["args"].get("title", None) + if not title: + title = json.loads(player_config["args"]["player_response"])["videoDetails"]["title"] + if not title: + title = "Unknown title" + + filename = sanitize_filename(title) + "." + extension return video_url, filename