mirror of
https://github.com/wukko/cobalt.git
synced 2025-02-15 23:36:37 +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])
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
if (id.includes("--")) id = id.split("--")[1];
|
||||
if (!id) return { error: "fetch.fail" };
|
||||
|
||||
|
@ -26,8 +27,8 @@ export default async function(o) {
|
|||
|
||||
if (videoLink) return {
|
||||
urls: videoLink,
|
||||
filename: `pinterest_${o.id}.mp4`,
|
||||
audioFilename: `pinterest_${o.id}_audio`
|
||||
filename: `pinterest_${id}.mp4`,
|
||||
audioFilename: `pinterest_${id}_audio`
|
||||
}
|
||||
|
||||
const imageLink = [...html.matchAll(imageRegex)]
|
||||
|
@ -39,7 +40,7 @@ export default async function(o) {
|
|||
if (imageLink) return {
|
||||
urls: imageLink,
|
||||
isPhoto: true,
|
||||
filename: `pinterest_${o.id}.${imageType}`
|
||||
filename: `pinterest_${id}.${imageType}`
|
||||
}
|
||||
|
||||
return { error: "fetch.empty" };
|
||||
|
|
Loading…
Reference in a new issue