From 709d14ee9eac0cef00e9168f1a937f6d405361fc Mon Sep 17 00:00:00 2001 From: hyperdefined Date: Mon, 29 Apr 2024 15:11:25 -0400 Subject: [PATCH] feat: ddinstagram.com support (#402) Co-authored-by: dumbmoron --- src/modules/processing/servicesConfig.json | 1 + src/modules/processing/url.js | 6 ++++++ src/test/tests.json | 24 ++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/modules/processing/servicesConfig.json b/src/modules/processing/servicesConfig.json index 8972ac46..4d61f7be 100644 --- a/src/modules/processing/servicesConfig.json +++ b/src/modules/processing/servicesConfig.json @@ -79,6 +79,7 @@ }, "instagram": { "alias": "instagram reels, posts & stories", + "altDomains": ["ddinstagram.com"], "patterns": [ "reels/:postId", ":username/reel/:postId", "reel/:postId", "p/:postId", ":username/p/:postId", "tv/:postId", "stories/:username/:storyId" diff --git a/src/modules/processing/url.js b/src/modules/processing/url.js index b272ff80..c723cb91 100644 --- a/src/modules/processing/url.js +++ b/src/modules/processing/url.js @@ -64,6 +64,12 @@ export function aliasURL(url) { if (url.hostname === 'dai.ly' && parts.length === 2) { url = new URL(`https://dailymotion.com/video/${parts[1]}`) } + break; + case "ddinstagram": + if (services.instagram.altDomains.includes(host.domain) && [null, 'd', 'g'].includes(host.subdomain)) { + url.hostname = 'instagram.com'; + } + break; } return url diff --git a/src/test/tests.json b/src/test/tests.json index 9fccaa7e..95c95a65 100644 --- a/src/test/tests.json +++ b/src/test/tests.json @@ -878,6 +878,30 @@ "code": 200, "status": "redirect" } + }, { + "name": "ddinstagram link", + "url": "https://ddinstagram.com/p/CmCVWoIr9OH/", + "params": {}, + "expected": { + "code": 200, + "status": "redirect" + } + }, { + "name": "d.ddinstagram.com link", + "url": "https://d.ddinstagram.com/p/CmCVWoIr9OH/", + "params": {}, + "expected": { + "code": 200, + "status": "redirect" + } + }, { + "name": "g.ddinstagram.com link", + "url": "https://g.ddinstagram.com/p/CmCVWoIr9OH/", + "params": {}, + "expected": { + "code": 200, + "status": "redirect" + } }], "vine": [{ "name": "regular vine link (9+10=21)",