Open bcongdon opened 5 years ago
@bcongdon can you clarify which field are you referring to? There is snippet.publishedAt
, but I don't see anything related to addition date: https://developers.google.com/youtube/v3/docs/playlistItems
snippet.publishedAt
is the addition date for PlaylistItem
(it's described as "The date and time that the item was added to the playlist").
That's in contrast to snippet.publishedAt on the Video
resource, which is the actual "publish" date
This seems to be a problem which intersects with the fact that playlist items are fetched in playlist order, not in publish order. For playlists longer than the per-page limit 50 items, you need to set a very long page size (>= the number of playlist items) for PodSync to consider finding the latest items. It also appears to require downloading all the items in order for the cleanup to then kick in afterward if you don’t want to keep them all.
I don’t see a way to avoid this easily with YouTube’s API, as they don’t publish any way to adjust the sorting behaviour in the request, and it also means PodSync is incurring lots of API calls in requesting metadata for all those items even if some of them are to be discarded immediately.
I wonder if an approach would be to add a setting for or make the default behaviour for Playlists to fetch all pages and limit on page_size
instead, then we could in fact handle sorting by PlaylistItem
’s publishedAt
. We could also use the db
’s cache of publishedAt
and contentDetails.itemCount
to reduce ongoing API calls (to just the queryFeed
call, instead of always running the subsequent queryItems
).
How about prefixing the "title" with the index for playlists only? Something like "snippet.position
snippet.title
" results in
The podcast app would just needs to sort episodes by name. Podcast Addict on android can do this, but that might not be universally supported everywhere.
I tested a version of this locally and it works well for playlists
However, it should not be merged as-is. It prefixes numbers to episodes from channels which is not desirable. If this is the sort of direction we want to go then we'd want to conditionalize this to playlists only :)
Currently episodes are sorted by their publish date (i.e. the video upload date).
It would be nice to be able to sort by playlist addition date (which is exposed on
PlaylistItem
for youtube playlist items).The use case is: If you add a really old video to a playlist, it gets added really far back in your feed, and many podcast clients won't download "old" episodes by default.