mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 19:28:29 +00:00
facebook: add shared link pattern
This commit is contained in:
parent
7f8dcde98c
commit
f1b1d35ea9
@ -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", {
|
||||
|
@ -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)
|
||||
|
@ -127,7 +127,8 @@
|
||||
"_shortLink/:shortLink",
|
||||
":username/videos/:caption/:id",
|
||||
":username/videos/:id",
|
||||
"reel/:id"
|
||||
"reel/:id",
|
||||
"share/v/:id"
|
||||
],
|
||||
"enabled": true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user