fix(youtube): "this playlist no longer exists" only where the user picked that list
playlistNotFound was mapped to "gone" everywhere: exploring a channel without uploads (its uploads list answers not found) and a list deleted mid bulk pull both said a playlist no longer exists. The reason is now "gone" only on single-playlist routes; explore reads it as an empty back-catalogue, and the bulk pull skips that list and syncs the rest.
This commit is contained in:
@@ -25,7 +25,7 @@ from app.models import (
|
||||
)
|
||||
from app.sync.videos import insert_stubs, stub_from_playlist_item, apply_video_details
|
||||
from app.utils import now_utc as _now
|
||||
from app.youtube.client import YouTubeClient
|
||||
from app.youtube.client import YouTubeClient, YouTubeError, is_playlist_gone
|
||||
|
||||
log = logs.get_logger(__name__)
|
||||
|
||||
@@ -81,7 +81,15 @@ def explore_ingest_page(
|
||||
the organic deep backfill) is never touched."""
|
||||
if not channel.uploads_playlist_id:
|
||||
return {"ingested": 0, "next_page_token": None}
|
||||
data = yt.get_playlist_items(channel.uploads_playlist_id, page_token)
|
||||
try:
|
||||
data = yt.get_playlist_items(channel.uploads_playlist_id, page_token)
|
||||
except YouTubeError as exc:
|
||||
# A channel with no uploads has an uploads id that YouTube answers as not found: an empty
|
||||
# back-catalogue, not a failure (and not a "playlist gone" — the user picked a channel).
|
||||
if not is_playlist_gone(exc):
|
||||
raise
|
||||
log.info("explore ingest channel=%s has no uploads playlist", channel.id)
|
||||
return {"ingested": 0, "next_page_token": None}
|
||||
stubs: list[dict] = []
|
||||
for item in data.get("items", []):
|
||||
stub = stub_from_playlist_item(item, channel.id)
|
||||
|
||||
Reference in New Issue
Block a user