diff options
Diffstat (limited to 'youtube.py')
-rwxr-xr-x | youtube.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/youtube.py b/youtube.py index f15613e..1e60546 100755 --- a/youtube.py +++ b/youtube.py @@ -96,6 +96,9 @@ class YouTube: video_id = None try: playlist_id = qs["list"][0] + #ignore the "random mix" and "radio" lists + if playlist_id.startswith("RD"): + playlist_id = None except KeyError: playlist_id = None if (self.prefer_playlist and playlist_id) or (playlist_id and not video_id): @@ -104,7 +107,7 @@ class YouTube: url = url.scheme + "://" + url.netloc + url.path + "?v=" + video_id url = f"https://www.youtube.com/oembed?{urlencode([('url',url),('format','json')])}" try: - #print(url, " and ", playlist_id) + # print(url, " and ", playlist_id) data = urlopen(url).read().decode() data = json_loads(data) title = data["title"] @@ -125,8 +128,8 @@ class YouTube: if __name__ == "__main__": import sys - #if url is a video that's part of a playlist, - #return playlist (True) or video (False, default)? - #YouTube.prefer_playlist=False + # if url is a video that's part of a playlist, + # return playlist (True) or video (False, default)? + # YouTube.prefer_playlist=False YouTube().yt(sys.argv[1]) - #YouTube.yt(YouTube, sys.argv[1]) + # YouTube.yt(YouTube, sys.argv[1]) |