[YouTube] Support more YouTube channel URLs#1442
Merged
TobiGr merged 4 commits intoTeamNewPipe:devfrom Jan 30, 2026
Merged
Conversation
Contributor
|
Thank you, please fix the checkstyle issue and add tests for the newly supported channel URLs in YoutubeChannelLinkHandlerFactoryTest |
Contributor
Author
|
Thank you for going through my pull request! I fixed the checkstyle issue and added two URLs into YoutubeChannelLinkHandlerFactoryTest that were previously unsupported ( From running the tests, I noticed that |
0a579b5 to
9831bcc
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had a look at what kinds of YouTube channel URLs there are. They come in 5 forms:
https://www.youtube.com/jacksepticeye)"c/" + name(https://www.youtube.com/c/jacksepticeye)"user/" + name(https://www.youtube.com/user/jacksepticeye)https://www.youtube.com/@jacksepticeye)https://www.youtube.com/channel/UCYzPXprvl5Y-Sf0g4vX-m6g)In the current
getId()implementation, for non-handle-based URLs,c/is prepended to the URL path if it had only one component (i.e. looks like a name) and that component isn't one of the excluded segments. Then, if the URL path doesn't start withc/,user/orchannel/, it's rejected; otherwise,the first path component + "/" + the second path componentis returned.While this implementation works for the 5 URLs given above, it doesn't work when
"c/" + namedoes not lead to a valid channel URL. I've found that channel URLs are a little complicated:"user/" + nameworks for names likePewDiePie,DreamTraps,TEDtalksDirectorandmarkiplierGAME."user/" + namefails and"c/" + nameworks forElectroBOOMand노마드코더NomadCoders."c/" + nameand"user/" + namecreate technically valid URLs forLofiGirlandveritasium, but they lead to completely different channels."@" + nameworks for some of the names I listed (e.g.PewDiePie), but not for all of them (e.g.DreamTraps).dreamandDreamTraps;markiplierandmarkiplierGAME;TEDandTEDtalksDirector), with"c/" + name","user/" + nameand"@" + name"working or failing (e.g."c/TED"and"@TED"work but"user/TED"doesn't;"user/TEDtalksDirector"works but"c/TEDtalksDirector"and"@TEDtalksDirector"don't).Since
"c/" + nameand prepending other components to the name doesn't always give a valid channel URL, this pull request modifiesgetId()to consider URLs containing just a name to be valid. This makes thehttps://www.youtube.com/DreamTrapsURL given in #965 work, as well as other URLs likehttps://www.youtube.com/PewDiePie.Though this pull request doesn't add support for every valid YouTube channel URL (e.g.
https://www.youtube.com/jacksepticeyeworks buthttps://www.youtube.com/jacksepticeye/videosdoesn't; an edge case likehttps://www.youtube.com/select_site/videosdoesn't work), it fixes #965. On a side note, it looks like TeamNewPipe/NewPipe#9436 was already fixed before this pull request was made.