mirror of
https://github.com/wukko/cobalt.git
synced 2025-02-19 09:28:48 +01:00
api/pinterest: fix undefined
in name when downloading shortlink
This commit is contained in:
parent
a758b1dbc6
commit
5db5437b62
1 changed files with 4 additions and 3 deletions
|
@ -11,6 +11,7 @@ export default async function(o) {
|
||||||
.then(r => r.headers.get("location").split('pin/')[1].split('/')[0])
|
.then(r => r.headers.get("location").split('pin/')[1].split('/')[0])
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id.includes("--")) id = id.split("--")[1];
|
if (id.includes("--")) id = id.split("--")[1];
|
||||||
if (!id) return { error: "fetch.fail" };
|
if (!id) return { error: "fetch.fail" };
|
||||||
|
|
||||||
|
@ -26,8 +27,8 @@ export default async function(o) {
|
||||||
|
|
||||||
if (videoLink) return {
|
if (videoLink) return {
|
||||||
urls: videoLink,
|
urls: videoLink,
|
||||||
filename: `pinterest_${o.id}.mp4`,
|
filename: `pinterest_${id}.mp4`,
|
||||||
audioFilename: `pinterest_${o.id}_audio`
|
audioFilename: `pinterest_${id}_audio`
|
||||||
}
|
}
|
||||||
|
|
||||||
const imageLink = [...html.matchAll(imageRegex)]
|
const imageLink = [...html.matchAll(imageRegex)]
|
||||||
|
@ -39,7 +40,7 @@ export default async function(o) {
|
||||||
if (imageLink) return {
|
if (imageLink) return {
|
||||||
urls: imageLink,
|
urls: imageLink,
|
||||||
isPhoto: true,
|
isPhoto: true,
|
||||||
filename: `pinterest_${o.id}.${imageType}`
|
filename: `pinterest_${id}.${imageType}`
|
||||||
}
|
}
|
||||||
|
|
||||||
return { error: "fetch.empty" };
|
return { error: "fetch.empty" };
|
||||||
|
|
Loading…
Reference in a new issue