-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local API: Extract playlists on the auto-generated "Music" channel #5250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example playlist for no views
https://youtube.com/playlist?list=RDCLAK5uy_k5n4srrEB1wgvIjPNTXS9G1ufE9WQxhnA
Or keep finding one in https://www.youtube.com/music
@@ -340,7 +340,7 @@ export default defineComponent({ | |||
this.playlistDescription = result.info.description ?? '' | |||
this.firstVideoId = result.items[0].id | |||
this.playlistThumbnail = result.info.thumbnails[0].url | |||
this.viewCount = extractNumberFromString(result.info.views) | |||
this.viewCount = result.info.views.toLowerCase() === 'no views' ? 0 : extractNumberFromString(result.info.views) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (non-blocking): We have a few places in the code where we use extractNumberFromString
and it ends up getting used as NaN
. I get from an "API" level why NaN
is an appropriate return value, but it is this behavior that ultimately results in us displaying NaN
throughout the app. I'd recommend returning 0
instead of NaN
from that function in both the not-string case and NaN
parseInt
case just to cover the swathe of edge cases more easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you are correct that in many places we don't handle NaN
and just display it to the user, in other places we actually rely on it, so we know when to hide UI elements for example.
So we either need to create a separate wrapper function the converts the NaN
to zero in the places where that is desired or add an extra parameter to control when the fallback should be zero.
Local API: Extract playlists on the auto-generated "Music" channel
Pull Request Type
Description
This pull request adds support for extracting and displaying playlists on the auto-generated system "Music" channel. Unlike #5241 which adds support for a whole category of channels, this pull request is only for one specific one.
I also noticed that some of the playlists listed there were showing
NaN views
on the playlists page, so I fixed that so it correctly shows0 views
when YouTube saysNo views
.Screenshots
Testing
Open
https://www.youtube.com/music
in FreeTube and notice the playlists tab.Desktop