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 extraction of the Trending kiosk with the new data model returned #920

Merged
merged 1 commit into from
Sep 14, 2022

Conversation

AudricV
Copy link
Member

@AudricV AudricV commented Aug 28, 2022

  • I carefully read the contribution guidelines and agree to them.
  • I have tested the API against NewPipe.
    I didn't test the changes on NewPipe but tested multiple times the changes using the YoutubeTrendingKioskInfoTest test class

This pull request adds support of the new data model returned for trends, which is A/B tested or deployed by YouTube.

This new structure allow us to filter easily Trending shorts and Recently trending sections.

On the previous one, this Recently trending section is now filtered (the Trending shorts one uses a different structure, which so was already not extracted), by checking whether sections have a title, which isn't the case for normal trends contrary to the other ones.

This makes that the extractor returns now only the real 50 Now YouTube trends, with both data models returned by YouTube.

Elements inside arrays are now extracted dynamically instead of only the ones of the first index, using Java 8's Stream API.

Note: The getInitialPage() method of YoutubeTrendingExtractor can now throw a ParsingException if no selected tab (corresponding to the one of the trends type extracted) has been found.

Finally, the licence header of this class has been moved to the top of the file and updated.

Fixes #899, fixes TeamNewPipe/NewPipe#8835.

@AudricV AudricV added bug Issue is related to a bug youtube service, https://www.youtube.com/ labels Aug 28, 2022
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.

Lgtm other than that small detail, thank you :-)

… section

This new structure allow us to filter easily Trending shorts and Recently
trending sections.

On the previous one, this Recently trending section is now filtered, by
checking whether sections have a title, which isn't the case for normal trends
contrary to the other ones.

This makes that the extractor returns now only the real 50 "Now" YouTube
trends.

Elements inside arrays are now extracted dynamically instead of only the ones
of the first index, using Java 8's Stream API.

The getInitialPage() method of YoutubeTrendingExtractor can now throw a
ParsingException if no selected tab (corresponding to the one of the trends
type extracted) has been found.

Finally, the licence header has been moved to the top of the file and updated.
@AudricV AudricV force-pushed the fix-yt-trending-extraction branch from 2e71cdf to d8ddeb5 Compare September 11, 2022 16:53
@AudricV AudricV requested a review from Stypox September 11, 2022 16:54
@Stypox Stypox merged commit 14ef430 into TeamNewPipe:dev Sep 14, 2022
@AudricV AudricV deleted the fix-yt-trending-extraction branch September 14, 2022 13:48
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.

Trending section sometimes show the "no videos" message [YouTube] Trending is empty sometimes
2 participants