YouTube usernames and vanity names can be different

This commit is contained in:
shinigami-eyes 2021-03-15 17:06:10 +00:00
parent 6b474eaf8a
commit 7ad527fa0c
1 changed files with 4 additions and 3 deletions

View File

@ -513,9 +513,10 @@ function getIdentifierFromURLImpl(url: URL): string {
} else if (domainIs(host, 'twitter.com')) {
return 'twitter.com' + getPartialPath(url.pathname, 1);
} else if (domainIs(host, 'youtube.com')) {
const pathname = url.pathname.replace('/c/', '/user/');
if (!pathname.startsWith('/user/') && !pathname.startsWith('/channel/')) return null;
return 'youtube.com' + getPartialPath(pathname, 2);
const pathname = url.pathname;
if (pathname.startsWith('/user/') || pathname.startsWith('/c/') || pathname.startsWith('/channel/'))
return 'youtube.com' + getPartialPath(pathname, 2);
return 'youtube.com' + getPartialPath(pathname, 1);
} else if (domainIs(host, 'disqus.com') && url.pathname.startsWith('/by/')) {
return 'disqus.com' + getPartialPath(url.pathname, 2);
} else if (domainIs(host, 'medium.com')) {