pinterest: fix id checking for shortened links
This commit is contained in:
parent
9976ec59c8
commit
45a85e5928
1 changed files with 4 additions and 4 deletions
|
@ -8,15 +8,15 @@ const videoLinkBase = {
|
||||||
export default async function(o) {
|
export default async function(o) {
|
||||||
let id = o.id, type = "regular";
|
let id = o.id, type = "regular";
|
||||||
|
|
||||||
if (id.includes("--")) {
|
|
||||||
id = id.split("--")[1];
|
|
||||||
type = "story";
|
|
||||||
}
|
|
||||||
if (!o.id && o.shortLink) {
|
if (!o.id && o.shortLink) {
|
||||||
id = await fetch(`https://api.pinterest.com/url_shortener/${o.shortLink}/redirect/`, { redirect: "manual" }).then((r) => {
|
id = await fetch(`https://api.pinterest.com/url_shortener/${o.shortLink}/redirect/`, { redirect: "manual" }).then((r) => {
|
||||||
return r.headers.get("location").split('pin/')[1].split('/')[0]
|
return r.headers.get("location").split('pin/')[1].split('/')[0]
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
if (id.includes("--")) {
|
||||||
|
id = id.split("--")[1];
|
||||||
|
type = "story";
|
||||||
|
}
|
||||||
if (!id) return { error: 'ErrorCouldntFetch' };
|
if (!id) return { error: 'ErrorCouldntFetch' };
|
||||||
|
|
||||||
let html = await fetch(`https://www.pinterest.com/pin/${id}/`, {
|
let html = await fetch(`https://www.pinterest.com/pin/${id}/`, {
|
||||||
|
|
Loading…
Reference in a new issue