1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-21 07:42:10 +02:00

bridges: add context to detectParameters (#3607)

* bridges: add context to detectParameters

Some bridges did not return the context parameter but they used it in
the parameters

* bridges: add context to detectParameters

Fix test for InstagramBridge
This commit is contained in:
sysadminstory
2023-08-09 22:40:24 +02:00
committed by GitHub
parent 6cc4cf24dc
commit 52d3cce59d
13 changed files with 115 additions and 80 deletions

View File

@@ -63,9 +63,9 @@ class InstagramBridge extends BridgeAbstract
];
const TEST_DETECT_PARAMETERS = [
'https://www.instagram.com/metaverse' => ['u' => 'metaverse'],
'https://instagram.com/metaverse' => ['u' => 'metaverse'],
'http://www.instagram.com/metaverse' => ['u' => 'metaverse'],
'https://www.instagram.com/metaverse' => ['context' => 'Username', 'u' => 'metaverse'],
'https://instagram.com/metaverse' => ['context' => 'Username', 'u' => 'metaverse'],
'http://www.instagram.com/metaverse' => ['context' => 'Username', 'u' => 'metaverse'],
];
const USER_QUERY_HASH = '58b6785bea111c67129decbe6a448951';
@@ -323,6 +323,7 @@ class InstagramBridge extends BridgeAbstract
$regex = '/^(https?:\/\/)?(www\.)?instagram\.com\/([^\/?\n]+)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'Username';
$params['u'] = urldecode($matches[3]);
return $params;
}