-
-
Notifications
You must be signed in to change notification settings - Fork 509
[YouTube] Catch RegexException in subscriber count extractor #1238
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
Conversation
When the subscriber count extraction fails to find the Regex pattern, a RegexException is thrown. This is not a fatal error in most cases, for example when downloading the channel page in order to update the user's subscriptions, and so the correct behavior is to return UNKNOWN_SUBSCRIBER_COUNT. Related issue: TeamNewPipe/NewPipe#11353. This bug comprises two issues: subscribers cannot be extracted for channels with pronoun tags, and when the RegexException is thrown, channel subscriptions will fail to update because the exception is uncaught. This commit fixes the latter aspect of the issue.
|
My comment where I identify the probable source of the parsing issue is here: TeamNewPipe/NewPipe#11353 (comment) |
|
I had a look at the CI failures and they seem clearly unrelated to my changes. Probably just flaky tests. |
|
Is there anything I can do to move this PR forward? It's a straightforward fix for a crash that continues to exist in the latest versions of NewPipe. |
|
Sorry for not looking at this earlier and thank you for the ping. Thank you for looking into this; I am closing this PR for the two reasons below, though you are welcome to open a new PR for the first one :-)
This should be fixed by detecting pronoun tags and returning
The exception is not actually uncaught, but is caught here. The error is added to a list of non-critical errors. NewPipe already handles those errors nicely:
Therefore I think this is already working as intended, but maybe we should change the UI for when a subscription was partially loaded (i.e. non-critical errors) vs when it was not loaded at all (i.e. critical error). |
|
Hey @Stypox, thanks for the review. I think there are several misunderstandings to correct though.
It's not that it's impossible to extract the subscriber count for channels with pronoun tags, it's that the extraction code is broken as I detailed on the bug report page. It only works for most channels right now by coincidence.
Maybe I'm misunderstanding you, because the handling doesn't seem nice at all. The result is not just that the subscription is marked as outdated, but also there's a full crash log pop up that appears in the user's notifications as if a major error has occurred. This is annoying and probably results in useless issues being sent. |
|
Sorry, I didn't see your comments in #11353, thank you for the analysis!
Then it needs to be fixed, even if fixing it can still lead to something that is flaky. There is already a mechanism that doesn't make the whole extraction fail if just the subscriber count extraction fails, as I said, so it's not considered a critical error.
As I said:
I agree it is not a good user experience. What I meant with "nice" was that the error is already properly handled in the correct way (i.e. the subscriptions, even the broken channel, do load fine, since the code handles the non-critical error as non-critical and proceeds). So to sum up, this is not the way to solve this bug, but you can do this instead:
|
When the subscriber count extraction fails to find the Regex pattern, a RegexException is thrown. This is not a fatal error in most cases, for example when downloading the channel page in order to update the user's subscriptions, and so the correct behavior is to return UNKNOWN_SUBSCRIBER_COUNT.
Related issue: TeamNewPipe/NewPipe#11353.
This bug comprises two issues: subscribers cannot be extracted for channels with pronoun tags, and when the RegexException is thrown, channel subscriptions will fail to update because the exception is uncaught. This commit fixes the latter aspect of the issue.
Please see my comment on the issue for suggestions on how the former issue with scraping the pronoun tags might be fixed.
Note that the last point above is not applicable to this PR, as the API does not change.