Skip to content

[YouTube] Support more YouTube channel URLs#1442

Merged
TobiGr merged 4 commits intoTeamNewPipe:devfrom
G-flat:support_more_yt_channels
Jan 30, 2026
Merged

[YouTube] Support more YouTube channel URLs#1442
TobiGr merged 4 commits intoTeamNewPipe:devfrom
G-flat:support_more_yt_channels

Conversation

@G-flat
Copy link
Copy Markdown
Contributor

@G-flat G-flat commented Jan 26, 2026

  • 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.

I had a look at what kinds of YouTube channel URLs there are. They come in 5 forms:

  1. A name (https://www.youtube.com/jacksepticeye)
  2. "c/" + name (https://www.youtube.com/c/jacksepticeye)
  3. "user/" + name (https://www.youtube.com/user/jacksepticeye)
  4. A YouTube handle (https://www.youtube.com/@jacksepticeye)
  5. A channel ID (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 with c/, user/ or channel/, it's rejected; otherwise, the first path component + "/" + the second path component is returned.

While this implementation works for the 5 URLs given above, it doesn't work when "c/" + name does not lead to a valid channel URL. I've found that channel URLs are a little complicated:

  • "user/" + name works for names like PewDiePie, DreamTraps, TEDtalksDirector and markiplierGAME.
  • "user/" + name fails and "c/" + name works for ElectroBOOM and 노마드코더NomadCoders.
  • "c/" + name and "user/" + name create technically valid URLs for LofiGirl and veritasium, but they lead to completely different channels.
  • "@" + name works for some of the names I listed (e.g. PewDiePie), but not for all of them (e.g. DreamTraps).
  • A channel can have more than one name (dream and DreamTraps; markiplier and markiplierGAME; TED and TEDtalksDirector), with "c/" + name", "user/" + name and "@" + 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/" + name and prepending other components to the name doesn't always give a valid channel URL, this pull request modifies getId() to consider URLs containing just a name to be valid. This makes the https://www.youtube.com/DreamTraps URL given in #965 work, as well as other URLs like https://www.youtube.com/PewDiePie.

Though this pull request doesn't add support for every valid YouTube channel URL (e.g. https://www.youtube.com/jacksepticeye works but https://www.youtube.com/jacksepticeye/videos doesn't; an edge case like https://www.youtube.com/select_site/videos doesn't work), it fixes #965. On a side note, it looks like TeamNewPipe/NewPipe#9436 was already fixed before this pull request was made.

@ShareASmile ShareASmile added enhancement New feature or request YouTube Service, https://www.youtube.com/ labels Jan 26, 2026
@TobiGr
Copy link
Copy Markdown
Contributor

TobiGr commented Jan 29, 2026

Thank you, please fix the checkstyle issue and add tests for the newly supported channel URLs in YoutubeChannelLinkHandlerFactoryTest

@G-flat
Copy link
Copy Markdown
Contributor Author

G-flat commented Jan 30, 2026

Thank you for going through my pull request!

I fixed the checkstyle issue and added two URLs into YoutubeChannelLinkHandlerFactoryTest that were previously unsupported (https://www.youtube.com/PewDiePie and https://www.youtube.com/DreamTraps).

From running the tests, I noticed that linkHandler.acceptUrl("https://www.youtube.com/?app=desktop&persist_app=1") doesn't return false as expected because splitPath ended up being just [""], so I fixed the regression by adding a zero-length check in isCustomShortChannelUrl().

@TobiGr TobiGr force-pushed the support_more_yt_channels branch from 0a579b5 to 9831bcc Compare January 30, 2026 14:47
Copy link
Copy Markdown
Contributor

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

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

thanks!

@TobiGr TobiGr merged commit e4e5ccc into TeamNewPipe:dev Jan 30, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request YouTube Service, https://www.youtube.com/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some Channel URLs are assumed to be a prefix of /c/

3 participants