From ee48dbe4b90b051c62a8e7288500d104c9d6a8f1 Mon Sep 17 00:00:00 2001 From: Aria Stewart Date: Sun, 20 Mar 2022 17:02:56 -0400 Subject: [PATCH] support twitter communities --- extension/content.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extension/content.ts b/extension/content.ts index 0f86d82..4ccf681 100644 --- a/extension/content.ts +++ b/extension/content.ts @@ -513,7 +513,14 @@ function getIdentifierFromURLImpl(url: URL): string { if (pathname.includes('/comments/') && hostname == 'reddit.com') return null; return 'reddit.com' + getPartialPath(pathname, 2); } else if (domainIs(host, 'twitter.com')) { - return 'twitter.com' + getPartialPath(url.pathname, 1); + const isSpecial = url.pathname.startsWith('/i/'); + const isCommunity = url.pathname.startsWith('/i/communities/'); + if (isCommunity) { + return 'twitter.com' + getPartialPath(url.pathname, 3); + } else if (!isSpecial) { + return 'twitter.com' + getPartialPath(url.pathname, 1); + } + return null; } else if (domainIs(host, 'youtube.com')) { const pathname = url.pathname; if (pathname.startsWith('/user/') || pathname.startsWith('/c/') || pathname.startsWith('/channel/'))