diff --git a/src/modules/processing/match.js b/src/modules/processing/match.js index 805e9f06..413bf1ea 100644 --- a/src/modules/processing/match.js +++ b/src/modules/processing/match.js @@ -194,7 +194,7 @@ export default async function(host, patternMatch, lang, obj) { id: patternMatch.id }); case "facebook": - r = await facebook(patternMatch); + r = await facebook(url.href, patternMatch); break; default: return createResponse("error", { diff --git a/src/modules/processing/services/facebook.js b/src/modules/processing/services/facebook.js index a6809f4d..3f40dd1f 100644 --- a/src/modules/processing/services/facebook.js +++ b/src/modules/processing/services/facebook.js @@ -24,8 +24,9 @@ function resolveUrl(url) { .catch(() => false) } -export default async function ({ shortLink, username, id }) { +export default async function (sourceUrl, { shortLink, username, id }) { const isShortLink = !!shortLink?.length + const isSharedLink = !!sourceUrl.match(/\/share\/v\//)?.length let url = isShortLink ? `https://fb.watch/${shortLink}` @@ -35,6 +36,10 @@ export default async function ({ shortLink, username, id }) { url = await resolveUrl(url) } + if (isSharedLink) { + url = sourceUrl + } + const html = await fetch(url, { headers }) .then(r => r.text()) .catch(() => false) diff --git a/src/modules/processing/servicesConfig.json b/src/modules/processing/servicesConfig.json index 9978347b..aaa7a2ce 100644 --- a/src/modules/processing/servicesConfig.json +++ b/src/modules/processing/servicesConfig.json @@ -127,7 +127,8 @@ "_shortLink/:shortLink", ":username/videos/:caption/:id", ":username/videos/:id", - "reel/:id" + "reel/:id", + "share/v/:id" ], "enabled": true }