mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
[ImgsedBridge] Add detectParameters feature to the bridge (#3604)
The bridge can detect the most common profile variation URL of instagram.com or imgsed.com websites to extract the username.
This commit is contained in:
parent
b86ee5778b
commit
f3896ed543
@ -256,4 +256,30 @@ HTML,
|
|||||||
}
|
}
|
||||||
return parent::getName();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user