feat: rewrite channel api endpoints in reversed order
This commit is contained in:
@@ -30,9 +30,9 @@ import ythdd_struct_parser
|
|||||||
# [✓] /api/v1/comments/:videoid?continuation=...
|
# [✓] /api/v1/comments/:videoid?continuation=...
|
||||||
# [✓] /api/v1/videos/:videoIdXXXX
|
# [✓] /api/v1/videos/:videoIdXXXX
|
||||||
# [✓] /api/v1/playlists/:plid
|
# [✓] /api/v1/playlists/:plid
|
||||||
|
# [✓] /api/v1/channel/{videos, shorts, playlists, streams, latest?}/:ucid (rewrite)
|
||||||
# ----------
|
# ----------
|
||||||
# PLANNED:
|
# PLANNED:
|
||||||
# [X] /api/v1/channel/{videos, shorts, playlists, streams, latest?}/:ucid (rewrite)
|
|
||||||
# [X] /api/v1/:videoIdXXXX/maxres.jpg redirects to best quality thumbnail
|
# [X] /api/v1/:videoIdXXXX/maxres.jpg redirects to best quality thumbnail
|
||||||
# [X] /api/v1/storyboards/:videoIdXXXX
|
# [X] /api/v1/storyboards/:videoIdXXXX
|
||||||
# [X] /api/v1/videos/:videoIdXXXX does not depend on yt-dlp and offloads stream retrieval elsewhere (making initial response fast)
|
# [X] /api/v1/videos/:videoIdXXXX does not depend on yt-dlp and offloads stream retrieval elsewhere (making initial response fast)
|
||||||
@@ -795,8 +795,12 @@ def channels(data, req, only_json: bool = False):
|
|||||||
if len(data) < 4:
|
if len(data) < 4:
|
||||||
return send(400, {"error": "No channel specified."})
|
return send(400, {"error": "No channel specified."})
|
||||||
|
|
||||||
|
if len(data) > 4 and len(data[4]) == 24 and data[4].startswith("UC"):
|
||||||
|
# reversed order (/api/v1/api/invidious/channels/videos/UC...)
|
||||||
|
data[3], data[4] = data[4], data[3]
|
||||||
# silly sanity check
|
# silly sanity check
|
||||||
if len(data[3]) != 24 or not data[3].startswith("UC"):
|
if len(data[3]) != 24 or not data[3].startswith("UC"):
|
||||||
|
# typical order (/api/v1/api/invidious/channels/UC.../videos)
|
||||||
return send(404, {"error": "This channel does not exist."})
|
return send(404, {"error": "This channel does not exist."})
|
||||||
|
|
||||||
if len(data) > 4:
|
if len(data) > 4:
|
||||||
|
|||||||
Reference in New Issue
Block a user