Skip to content
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

[YouTube] Fix the extraction of series playlists and don't return the view count as the stream count for learning playlists #811

Merged

Conversation

AudricV
Copy link
Member

@AudricV AudricV commented Mar 12, 2022

These changes need testing on every playlist type available, because I removed some old code related to the extraction of a playlist type, which seems to be not used anymore by YouTube.

This PR fixes the extraction of YouTube series playlists and the extraction of the stream count for learning playlists: instead of returning the view count of the playlist as the stream count, ITEM_COUNT_UNKNOWN is now returned for these playlists.

Because some of the methods in the PlaylistExtractor abstract class are mostly overriden with the same return value in inherited classes, I implemented them in the base class instead and they are now only overridden where it's relevant.

I also improved and refactored a bit the classes which extends the PlaylistExtractor one (use of the Java 8 Streaming API and the StandardCharsets class, use of the final keyword where possible, etc.).

This PR fixes TeamNewPipe/NewPipe#5004 and fixes TeamNewPipe/NewPipe#7609.

Debug APK to test the changes: app-debug.zip

Sorry, something went wrong.

@AudricV AudricV added bug Issue is related to a bug youtube service, https://www.youtube.com/ labels Mar 12, 2022
@AudricV
Copy link
Member Author

AudricV commented Mar 12, 2022

@sovietscout @yashpalgoyal1304 Could you test this APK and see if it fixes the issues? Thank you in advance.

Copy link
Member

@litetex litetex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please remove the "fixes" for suggestions and mixes - they will be fixed via #813

@goyalyashpal
Copy link

I tested the attested apk with the links given at TeamNewPipe/NewPipe#7609 (comment) and:

  • the correct video count is shown in all except the learning playlist type
  • playlists of all 4 types now open via links (so, cell at C5)
  • the playlists of SE-- type are still not searchable it seems

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks almost good to me, thank you!

As always the real fix is in between a hundred other unrelated changed lines :-/

AudricV added 5 commits March 16, 2022 19:18
This will prevent their override in each child class where the values corresponding to the methods could not be extracted.
Also fix some issues in the extractors, remove uneeded overrides, use the Java 8 Stream API where possible and replace usages of Utils.UTF_8 with StandardCharsets.UTF_8 in these classes.
…w count as the stream count for learning playlists

ITEM_COUNT_UNKNOWN is returned when the JSON array which contains usally the number of videos is less than 3 items.
Also apply the same type of optimizations done in other PlaylistExtractors in YoutubePlaylistExtractor.
@AudricV AudricV force-pushed the playlists-improvements-and-yt-playlists-fixes branch from fff8ab0 to c7757c0 Compare March 16, 2022 19:14
@AudricV
Copy link
Member Author

AudricV commented Mar 16, 2022

Please remove the "fixes" for suggestions and mixes

Done.

@AudricV AudricV requested a review from Stypox March 16, 2022 19:16
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good and tests succeed, lgtm

@litetex litetex merged commit cd8088b into TeamNewPipe:dev Mar 17, 2022
@AudricV AudricV deleted the playlists-improvements-and-yt-playlists-fixes branch March 17, 2022 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug youtube service, https://www.youtube.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playlist link for youtube series is not supported Learning playlist "views" mislabeled as "videos"
4 participants