updated playlist id parsing for new playlist id format
This commit is contained in:
parent
f2848e9ac2
commit
8c8affde5a
|
|
@ -114,7 +114,9 @@ class Parser:
|
||||||
item_type = "video"
|
item_type = "video"
|
||||||
elif len_id_str == 24:
|
elif len_id_str == 24:
|
||||||
item_type = "channel"
|
item_type = "channel"
|
||||||
elif len_id_str in (34, 26, 18) or id_str.startswith("TA_playlist_"):
|
elif len_id_str in (34, 26, 18, 13) or id_str.startswith(
|
||||||
|
"TA_playlist_"
|
||||||
|
):
|
||||||
item_type = "playlist"
|
item_type = "playlist"
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"not a valid id_str: {id_str}")
|
raise ValueError(f"not a valid id_str: {id_str}")
|
||||||
|
|
|
||||||
|
|
@ -77,15 +77,28 @@ CHANNEL_VID_TYPES = [
|
||||||
PLAYLIST_URL_IN = [
|
PLAYLIST_URL_IN = [
|
||||||
"PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5",
|
"PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5",
|
||||||
"https://www.youtube.com/playlist?list=PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5",
|
"https://www.youtube.com/playlist?list=PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5",
|
||||||
|
"https://www.youtube.com/playlist?list=PLE6-bhDW8GWg",
|
||||||
]
|
]
|
||||||
PLAYLIST_OUT = [
|
PLAYLIST_OUT = [
|
||||||
{
|
{
|
||||||
"type": "playlist",
|
"type": "playlist",
|
||||||
"url": "PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5",
|
"url": "PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5",
|
||||||
"vid_type": "unknown",
|
"vid_type": "unknown",
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"type": "playlist",
|
||||||
|
"url": "PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5",
|
||||||
|
"vid_type": "unknown",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "playlist",
|
||||||
|
"url": "PLE6-bhDW8GWg",
|
||||||
|
"vid_type": "unknown",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
PLAYLIST_TEST_CASES = [
|
||||||
|
(i, [PLAYLIST_OUT[idx]]) for idx, i in enumerate(PLAYLIST_URL_IN)
|
||||||
]
|
]
|
||||||
PLAYLIST_TEST_CASES = [(i, PLAYLIST_OUT) for i in PLAYLIST_URL_IN]
|
|
||||||
|
|
||||||
# personal playlists
|
# personal playlists
|
||||||
EXPECTED_WL = [{"type": "playlist", "url": "WL", "vid_type": "unknown"}]
|
EXPECTED_WL = [{"type": "playlist", "url": "WL", "vid_type": "unknown"}]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue