Skip to content

best way to save what you love

pinterest: fix id checking for shortened links

wukko45a85e5928d5
diff --git a/src/modules/processing/services/pinterest.js b/src/modules/processing/services/pinterest.js
index 156b65cd..0f14eebf 100644
--- a/src/modules/processing/services/pinterest.js
+++ b/src/modules/processing/services/pinterest.js
@@ -8,15 +8,15 @@ const videoLinkBase = {
export default async function(o) {
let id = o.id, type = "regular";
- if (id.includes("--")) {
- id = id.split("--")[1];
- type = "story";
- }
if (!o.id && o.shortLink) {
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]
}).catch(() => {});
}
+ if (id.includes("--")) {
+ id = id.split("--")[1];
+ type = "story";
+ }
if (!id) return { error: 'ErrorCouldntFetch' };
let html = await fetch(`https://www.pinterest.com/pin/${id}/`, {