diff --git a/backend/common/src/urlparser.py b/backend/common/src/urlparser.py index c3b80690..527bbd98 100644 --- a/backend/common/src/urlparser.py +++ b/backend/common/src/urlparser.py @@ -114,7 +114,9 @@ class Parser: item_type = "video" elif len_id_str == 24: 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" else: raise ValueError(f"not a valid id_str: {id_str}") diff --git a/backend/common/tests/test_src/test_urlparser.py b/backend/common/tests/test_src/test_urlparser.py index 866624ba..6222b597 100644 --- a/backend/common/tests/test_src/test_urlparser.py +++ b/backend/common/tests/test_src/test_urlparser.py @@ -77,15 +77,28 @@ CHANNEL_VID_TYPES = [ PLAYLIST_URL_IN = [ "PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5", "https://www.youtube.com/playlist?list=PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5", + "https://www.youtube.com/playlist?list=PLE6-bhDW8GWg", ] PLAYLIST_OUT = [ { "type": "playlist", "url": "PL96C35uN7xGJu6skU4TBYrIWxggkZBrF5", "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 EXPECTED_WL = [{"type": "playlist", "url": "WL", "vid_type": "unknown"}]