summaryrefslogtreecommitdiff
path: root/youtube.py
diff options
context:
space:
mode:
authorPawky Languish2024-11-28 18:49:54 +0000
committerPawky Languish2024-11-28 18:49:54 +0000
commit225f83f5a5f077d7b7f7c476f825a0ded8008b74 (patch)
tree9d21790c630b7130b25638a7e972a2f4d0bc983b /youtube.py
parent3a6db0d0d3b9e2ce250c4c9c020d7ece4e953b13 (diff)
add apple music
Diffstat (limited to 'youtube.py')
-rwxr-xr-xyoutube.py13
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])