Skip to content

best way to save what you love

small fix for instagram reels

wukkofafd2c8ccc7b
diff --git a/package.json b/package.json
index 12851718..b4365ce7 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "cobalt",
"description": "save what you love",
- "version": "6.2.2",
+ "version": "6.2.3",
"author": "wukko",
"exports": "./src/cobalt.js",
"type": "module",
diff --git a/src/modules/processing/services/instagram.js b/src/modules/processing/services/instagram.js
index 3bcb7246..8544d103 100644
--- a/src/modules/processing/services/instagram.js
+++ b/src/modules/processing/services/instagram.js
@@ -17,6 +17,7 @@ export default async function(obj) {
if (!html.includes('application/ld+json')) return { error: 'ErrorEmptyDownload' };
let single, multiple = [], postInfo = JSON.parse(html.split('script type="application/ld+json"')[1].split('">')[1].split('</script>')[0]);
+ if (Array.isArray(postInfo)) postInfo = postInfo[0];
if (postInfo.video.length > 1) {
for (let i in postInfo.video) { multiple.push({type: "video", thumb: postInfo.video[i]["thumbnailUrl"], url: postInfo.video[i]["contentUrl"]}) }
diff --git a/src/modules/processing/servicesConfig.json b/src/modules/processing/servicesConfig.json
index ddd798c5..2af1622c 100644
--- a/src/modules/processing/servicesConfig.json
+++ b/src/modules/processing/servicesConfig.json
@@ -23,7 +23,7 @@
},
"youtube": {
"alias": "youtube videos & shorts & music",
- "patterns": ["watch?v=:id"],
+ "patterns": ["watch?v=:id", "embed/:id"],
"bestAudio": "opus",
"enabled": true
},
diff --git a/src/test/tests.json b/src/test/tests.json
index d374968c..ada655fe 100644
--- a/src/test/tests.json
+++ b/src/test/tests.json
@@ -893,6 +893,22 @@
"code": 400,
"status": "error"
}
+ }, {
+ "name": "post info in an array (for whatever reason??)",
+ "url": "https://www.instagram.com/reel/CrVB9tatUDv/?igshid=blaBlABALALbLABULLSHIT==",
+ "params": {},
+ "expected": {
+ "code": 200,
+ "status": "redirect"
+ }
+ }, {
+ "name": "prone to get rate limited",
+ "url": "https://www.instagram.com/reel/CrO-T7Qo6rq/?igshid=fuckYouNoTrackingIdForYou==",
+ "params": {},
+ "expected": {
+ "code": 200,
+ "status": "redirect"
+ }
}],
"vine": [{
"name": "regular vine link (9+10=21)",