bookmarks
This commit is contained in:
@@ -396,6 +396,20 @@ function normalizeFacebookPostUrl(rawValue) {
|
||||
parsed.protocol = 'https:';
|
||||
parsed.port = '';
|
||||
|
||||
const normalizedPathBeforeTrim = parsed.pathname.replace(/\/+$/, '') || '/';
|
||||
const lowerPathBeforeTrim = normalizedPathBeforeTrim.toLowerCase();
|
||||
const watchId = parsed.searchParams.get('v') || parsed.searchParams.get('video_id');
|
||||
if ((lowerPathBeforeTrim === '/watch' || lowerPathBeforeTrim === '/video.php') && watchId) {
|
||||
parsed.pathname = `/reel/${watchId}/`;
|
||||
parsed.search = '';
|
||||
} else {
|
||||
const reelMatch = lowerPathBeforeTrim.match(/^\/reel\/([^/]+)$/);
|
||||
if (reelMatch) {
|
||||
parsed.pathname = `/reel/${reelMatch[1]}/`;
|
||||
parsed.search = '';
|
||||
}
|
||||
}
|
||||
|
||||
const cleanedParams = new URLSearchParams();
|
||||
parsed.searchParams.forEach((paramValue, paramKey) => {
|
||||
const lowerKey = paramKey.toLowerCase();
|
||||
@@ -424,6 +438,11 @@ function normalizeFacebookPostUrl(rawValue) {
|
||||
}
|
||||
}
|
||||
|
||||
const normalizedPath = parsed.pathname.replace(/\/+$/, '').toLowerCase();
|
||||
if (normalizedPath.startsWith('/hashtag/') || normalizedPath.startsWith('/watch/hashtag/')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const search = cleanedParams.toString();
|
||||
const formatted = `${parsed.origin}${parsed.pathname}${search ? `?${search}` : ''}`;
|
||||
return formatted.replace(/[?&]$/, '');
|
||||
|
||||
Reference in New Issue
Block a user