Zod- / jsVideoUrlParser

A javascript parser to extract informations like provider, channel, id, start time from YouTube, Vimeo, Dailymotion, Twitch,... urls
MIT License
234 stars 73 forks source link

YouTube /c/ and /user/ aliases are treated interchangeably but might point to different accounts #76

Open cycloptux opened 3 years ago

cycloptux commented 3 years ago

Currently, the /c/ and /user/ URLs are both treated as interchangeable aliases within the YouTube parser, but this might not be true for all URLs.

Example: https://www.youtube.com/c/Defender833/ https://www.youtube.com/user/Defender833/

Both result in { name: 'Defender833', mediaType: 'channel', provider: 'youtube' } but they are actually different channels: when /c/ is used, the "Defender833" name refers to the customUrl parameter of the YouTube API (hence being found by looking for a generic search param) while with /user/ you are actually looking at the user name, which can be targeted by a different call within the YouTube API.

I was not aware of this until now but apparently, /user used to be the unique ID 2005-2013, at which point the userIDs (/channel/) got introduced. It was possible for a brief period to still claim usernames, but soon after, /c got implemented via Google+. As a consequence to this, while /c/ often is the same as /user/ for many folks, it can be something else.

It would be useful if there was a way to discern whether the channel name was of "user" or "c" type from the .parse function output.