mirror of
https://github.com/wukko/cobalt.git
synced 2025-01-27 21:26:18 +01:00
api/facebook: handle URLs with query parameters in share links
This commit is contained in:
parent
5be8789576
commit
943fe7991e
1 changed files with 7 additions and 1 deletions
|
@ -29,6 +29,12 @@ export default async function({ id, shareType, shortLink }) {
|
||||||
if (shareType) url = `https://web.facebook.com/share/${shareType}/${id}`;
|
if (shareType) url = `https://web.facebook.com/share/${shareType}/${id}`;
|
||||||
if (shortLink) url = await resolveUrl(`https://fb.watch/${shortLink}`);
|
if (shortLink) url = await resolveUrl(`https://fb.watch/${shortLink}`);
|
||||||
|
|
||||||
|
// Handle URLs with query parameters like ?mibextid
|
||||||
|
if (url.includes('?')) {
|
||||||
|
const urlObj = new URL(url);
|
||||||
|
url = urlObj.origin + urlObj.pathname;
|
||||||
|
}
|
||||||
|
|
||||||
const html = await fetch(url, { headers })
|
const html = await fetch(url, { headers })
|
||||||
.then(r => r.text())
|
.then(r => r.text())
|
||||||
.catch(() => false);
|
.catch(() => false);
|
||||||
|
@ -54,4 +60,4 @@ export default async function({ id, shareType, shortLink }) {
|
||||||
filename: `${baseFilename}.mp4`,
|
filename: `${baseFilename}.mp4`,
|
||||||
audioFilename: `${baseFilename}_audio`,
|
audioFilename: `${baseFilename}_audio`,
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in a new issue