diff --git a/bridges/ImgsedBridge.php b/bridges/ImgsedBridge.php index 1555c578..5fe3eee8 100644 --- a/bridges/ImgsedBridge.php +++ b/bridges/ImgsedBridge.php @@ -256,4 +256,30 @@ HTML, } return parent::getName(); } + + public function detectParameters($url) + { + $params = [ + 'post' => 'on', + 'story' => 'on', + 'tagged' => 'on' + ]; + $regex = '/^http(s|):\/\/((www\.|)(instagram.com)\/([a-zA-Z0-9_\.]{1,30})\/(reels\/|tagged\/|) +|(www\.|)(imgsed.com)\/(stories\/|tagged\/|)([a-zA-Z0-9_\.]{1,30})\/)/'; + if (preg_match($regex, $url, $matches) > 0) { + // Extract detected domain using the regex + $domain = $matches[8] ?? $matches[4]; + if ($domain == 'imgsed.com') { + $params['u'] = $matches[10]; + return $params; + } else if ($domain == 'instagram.com') { + $params['u'] = $matches[5]; + return $params; + } else { + return null; + } + } else { + return null; + } + } }