ThetaDev/rustypipe
6
37
Fork
You've already forked rustypipe
12

Feature: Add PlaylistRss #38

Open
opened 2025年04月07日 11:40:54 +02:00 by a0kami · 2 comments

Hey,

First thing, thank you so much for such an amazing library, that's both a huge amount of work and a continuous effort to maintain after each youtube change!

Channel specific playlists and rss endpoints

I figured I'd use the channel_rss feature for the most part in my use case but I wish I could be more easily tell the difference between videos, shorts and lives. I've long used the UU prefixed whole channel playlist, but inquiring on the matter on other 3rd party clients, I not only found about the channel dedicated extra "videos", "shorts", "lives" and I'll come back to that, but also about the playlist rss endoint (eg: https://www.youtube.com/feeds/videos.xml?playlist_id=<PLAYLIST-ID>) thanks to thefranke.

There's an extra user endpoint for users (https://www.youtube.com/feeds/videos.xml?user=<USERNAME>), but it seems to basically be the very same as channel except for the id that maps to the username in the xml response.

Proposition: adding the playlist_rss feature

As I wished I could use playlist_rss same as channel_rss, I've forked the repo and made the basic changes for having a working version, would you be ok with me opening a draft Pull Request ?

On the current changes I renamed src/client/response/channel_rss.rs to just rss.rs and adding a single PlaylistRss struct for the response to deserialize because they share the exact same structure (except PlaylistRss takes both its own playlistId and a an extra channelId string field).
On the src/client side I duplicated channel_rss.rs into playlist_rss.rs and made the according change even for tests. Yet as those share most of the code I believe a better approach would be to have a single implementation specialized based on an enum but I'm not sure how to proceed and I'd rather seek advice.

I'm still new at rust so if you're in favor of the feature, I'm not at all settled on how to go about it and would greatly appreciate some guidance.

Extra thought about readily available playlists

Finally, same as the channel_videos_tab[_order] query which allows for "videos", "shorts" or "lives" tabs with their "popular", "newer", "older" ordering; it turns out there exist as many channel playlists ids derived from the channel id (if such content as been published) but with a different prefix making them reachable from the aforementioned rss endpoint. I thought we could maybe make those available as choice, something like query().playlist_rss<C, O>() to specify for category and ordering or maybe query().playlist_rss_tab[_order](channel_id, tab[, order]), but maybe in a second time as it's overkill and unreliable.

More specifically on those prefixes though, replacing the channel ID prefix UC with:

  • UU returns the playlist with "all" content
  • for "Videos" only:
    • UULP ordered by "popular"
    • UULF ordered by "newer"
  • for "Shorts" only:
    • UUPS ordered by "popular"
    • UUSH ordered by "newer"
  • for "Lives" only:
    • UUPV ordered by "popular"
    • UULV ordered by "newer"

Those prefixes are documented in freetube codebase.
((削除) Still looking for the eventual "older" ordering prefix (削除ここまで), explored the entire UUXX prefixes, there's no "older" ordering for playlist ID)

Hey, First thing, thank you so much for such an amazing library, that's both a huge amount of work and a continuous effort to maintain after each youtube change! ## Channel specific playlists and rss endpoints I figured I'd use the channel_rss feature for the most part in my use case but I wish I could be more easily tell the difference between videos, shorts and lives. I've long used the `UU` prefixed whole channel playlist, but inquiring on the matter on other 3rd party clients, I not only found about the channel dedicated extra "videos", "shorts", "lives" and I'll come back to that, but also about the playlist rss endoint (eg: `https://www.youtube.com/feeds/videos.xml?playlist_id=<PLAYLIST-ID>`) thanks to [thefranke](https://gist.github.com/thefranke/63853a6f8c499dc97bc17838f6cedcc2). There's an extra user endpoint for users (`https://www.youtube.com/feeds/videos.xml?user=<USERNAME>`), but it seems to basically be the very same as channel except for the id that maps to the username in the xml response. ## Proposition: adding the `playlist_rss` feature As I wished I could use `playlist_rss` same as `channel_rss`, I've forked the repo and made the basic changes for having a working version, would you be ok with me opening a draft Pull Request ? On the current changes I renamed `src/client/response/channel_rss.rs` to just `rss.rs` and adding a single `PlaylistRss` struct for the response to deserialize because they share the exact same structure (except `PlaylistRss` takes both its own `playlistId` and a an extra `channelId` string field). On the `src/client` side I duplicated `channel_rss.rs` into `playlist_rss.rs` and made the according change even for tests. Yet as those share most of the code I believe a better approach would be to have a single implementation specialized based on an enum but I'm not sure how to proceed and I'd rather seek advice. I'm still new at rust so if you're in favor of the feature, I'm not at all settled on how to go about it and would greatly appreciate some guidance. ## Extra thought about readily available playlists Finally, same as the `channel_videos_tab[_order]` query which allows for "videos", "shorts" or "lives" tabs with their "popular", "newer", "older" ordering; it turns out there exist as many channel playlists ids derived from the channel id (if such content as been published) but with a different prefix making them reachable from the aforementioned rss endpoint. I thought we could maybe make those available as choice, something like `query().playlist_rss<C, O>()` to specify for category and ordering or maybe `query().playlist_rss_tab[_order](channel_id, tab[, order])`, but maybe in a second time as it's overkill and unreliable. More specifically on those prefixes though, replacing the channel ID prefix `UC` with: - `UU` returns the playlist with "all" content - for "Videos" only: - `UULP` ordered by "popular" - `UULF` ordered by "newer" - for "Shorts" only: - `UUPS` ordered by "popular" - `UUSH` ordered by "newer" - for "Lives" only: - `UUPV` ordered by "popular" - `UULV` ordered by "newer" Those prefixes are documented in [freetube codebase](https://github.com/FreeTubeApp/FreeTube/blob/development/src/renderer/helpers/utils.js#L902). (~~Still looking for the eventual "older" ordering prefix~~, explored the entire UUXX prefixes, there's no "older" ordering for playlist ID)

Hi @a0kami, thanks for the tip. I did not know that YouTube has a RSS API for playlists too. You are welcome to add it to Rustypipe.

Edit: apparently playlists fetched via RSS are limited to the top 15 items. So it is mostly useful for the "virtual" channel playlists, since they get new videos added at the top.

Hi @a0kami, thanks for the tip. I did not know that YouTube has a RSS API for playlists too. You are welcome to add it to Rustypipe. Edit: apparently playlists fetched via RSS are limited to the top 15 items. So it is mostly useful for the "virtual" channel playlists, since they get new videos added at the top.
Author
Copy link

Thanks! I added the MR I've made attempt at when I submitted the issue. Mostly looking for properly adding the feature, especially the tests which are bugging me as I'm still new to rust.

And yes I figured the rss flaw, a single artist album featuring more than 15 titles and you're sure to miss entries, not a frequent event but realistic enough to trick you even though rss mechanism is lighter.
Regarding the PR, it's mostly identical to ChannelRss so I tried avoiding some redundancy.

I've kept the "all content"; "only videos"; "only shorts" and "only lives", sorted either by newer or popular, out of the MR and it has nothing to do with rss, but I wish they'd be available as a matter of simplicity, rss on youtube as been there for ages and is likely to be kept for compatibility for still a long while I assume. What are your thoughts about this ?

Thanks! I added the MR I've made attempt at when I submitted the issue. Mostly looking for properly adding the feature, especially the tests which are bugging me as I'm still new to rust. And yes I figured the rss flaw, a single artist album featuring more than 15 titles and you're sure to miss entries, not a frequent event but realistic enough to trick you even though rss mechanism is lighter. Regarding the PR, it's mostly identical to ChannelRss so I tried avoiding some redundancy. I've kept the "all content"; "only videos"; "only shorts" and "only lives", sorted either by newer or popular, out of the MR and it has nothing to do with rss, but I wish they'd be available as a matter of simplicity, rss on youtube as been there for ages and is likely to be kept for compatibility for still a long while I assume. What are your thoughts about this ?
Sign in to join this conversation.
No Branch/Tag specified
main
feat/deobf-extractor
abr-streaming
abr-streaming-wip
feat/timezone
feat/oauth
feat/http3
feat/postprocessor
feat/channel-tv
rustypipe/v0.11.4
rustypipe/v0.11.3
rustypipe/v0.11.2
rustypipe-cli/v0.7.2
rustypipe/v0.11.1
rustypipe-cli/v0.7.1
rustypipe-downloader/v0.3.1
rustypipe/v0.11.0
rustypipe-cli/v0.7.0
rustypipe-downloader/v0.3.0
rustypipe/v0.10.0
rustypipe-cli/v0.6.0
rustypipe-downloader/v0.2.7
rustypipe/v0.9.0
rustypipe-cli/v0.5.0
rustypipe-downloader/v0.2.6
rustypipe/v0.8.0
rustypipe-downloader/v0.2.5
rustypipe/v0.7.2
rustypipe/v0.7.1
rustypipe-cli/v0.4.0
rustypipe-downloader/v0.2.4
rustypipe/v0.7.0
rustypipe-cli/v0.3.0
rustypipe-downloader/v0.2.3
rustypipe/v0.6.0
rustypipe-cli/v0.2.2
rustypipe-downloader/v0.2.2
rustypipe/v0.5.0
rustypipe-cli/v0.2.1
rustypipe-downloader/v0.2.1
rustypipe/v0.4.0
rustypipe-cli/v0.2.0
rustypipe-downloader/v0.2.0
rustypipe/v0.3.0
rustypipe/v0.2.1
rustypipe-cli/v0.1.1
rustypipe-downloader/v0.1.1
rustypipe/v0.2.0
rustypipe/v0.1.3
rustypipe/v0.1.2
rustypipe/v0.1.1
rustypipe-cli/v0.1.0
rustypipe-downloader/v0.1.0
rustypipe/v0.1.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ThetaDev/rustypipe#38
Reference in a new issue
ThetaDev/rustypipe
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?