Entities in facebook groups (new layout) are now labeled correctly

This commit is contained in:
shinigami-eyes 2020-09-14 09:48:25 +00:00
parent dc48e3f36f
commit cc03be0e76

View File

@ -492,10 +492,14 @@ function getIdentifierFromURLImpl(url: URL): string {
if (host.startsWith('www.')) host = host.substring(4);
const pathArray = url.pathname.split('/');
if (domainIs(host, 'facebook.com')) {
const fbId = searchParams.get('id');
const p = url.pathname.replace('/pg/', '/');
return 'facebook.com/' + (fbId || getPartialPath(p, p.startsWith('/groups/') ? 2 : 1).substring(1));
const isGroup = p.startsWith('/groups/');
if (isGroup && p.includes('/user/')) return 'facebook.com/' + pathArray[4]; // fb.com/groups/.../user/...
return 'facebook.com/' + (fbId || getPartialPath(p, isGroup ? 2 : 1).substring(1));
} else if (domainIs(host, 'reddit.com')) {
const pathname = url.pathname.replace('/u/', '/user/');
if (!pathname.startsWith('/user/') && !pathname.startsWith('/r/')) return null;