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 serialization of Videos channel tab when it is already fetched #1222

Conversation

AudricV
Copy link
Member

@AudricV AudricV commented Sep 15, 2024

  • I carefully read the contribution guidelines and agree to them.
  • I have tested the API against NewPipe.
  • I agree to create a pull request for NewPipe as soon as possible to make it compatible with the changed API. Not needed, the API changes are on code that is not a part of the API that users should use (that's the case of NewPipe).

This PR fixes the ability to serialize ReadyChannelTabListLinkHandlers for YouTube channels. It was due to the usage of the channelHeader field of YoutubeChannelExtractor, as explained in TeamNewPipe/NewPipe#11356 (comment). Even if this usage has been removed by copying the instance members into a new object, the ChannelHeader class of YoutubeChannelHelper was not serializable, so crashes would still happen if I didn't make this class serializable.

Optional as fields and parameters of methods have been removed in the related extractor code as it is not a good practice. This simplifies in some places channel info extraction code.

This PR and the issue it fixes also raise the question of the limits of the serialization system we use, both in the app and in the extractor.

Debug NewPipe APK based on app commit 035c394cf6704c0af9077c01ebfa55b810d02140 with changes from commit 422df70: app-debug.zip

Fixes TeamNewPipe/NewPipe#11356.

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

Nice catch! I can't really reproduce the crash on NewPipe, but it totally makes sense that it might happen. Thank you for noticing and fixing!

@AudricV AudricV force-pushed the yt_fix-videos-channel-tab-linkhandler-serialization branch from 422df70 to 597eaee Compare September 16, 2024 11:46
Also remove usage of Optional as fields as it is not a good practice. This
simplifies in some places channel info extraction code.
@AudricV AudricV force-pushed the yt_fix-videos-channel-tab-linkhandler-serialization branch from 597eaee to 42c1afa Compare September 29, 2024 13:39
@AudricV AudricV merged commit eb30316 into TeamNewPipe:dev Sep 29, 2024
3 of 4 checks passed
@AudricV AudricV deleted the yt_fix-videos-channel-tab-linkhandler-serialization branch September 29, 2024 13:58
@ShareASmile ShareASmile mentioned this pull request Nov 7, 2024
6 tasks
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
2 participants