mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-14 20:21:14 +03:00
[InstagramBridge] Add detectParameters (#1476)
This commit is contained in:
parent
14a7516625
commit
26f0380aaa
1 changed files with 20 additions and 0 deletions
|
@ -55,6 +55,12 @@ class InstagramBridge extends BridgeAbstract {
|
|||
|
||||
);
|
||||
|
||||
const TEST_DETECT_PARAMETERS = array(
|
||||
'https://www.instagram.com/metaverse' => array('u' => 'metaverse'),
|
||||
'https://instagram.com/metaverse' => array('u' => 'metaverse'),
|
||||
'http://www.instagram.com/metaverse' => array('u' => 'metaverse'),
|
||||
);
|
||||
|
||||
const USER_QUERY_HASH = '58b6785bea111c67129decbe6a448951';
|
||||
const TAG_QUERY_HASH = '9b498c08113f1e09617a1703c22b2f32';
|
||||
const SHORTCODE_QUERY_HASH = '865589822932d1b43dfe312121dd353a';
|
||||
|
@ -278,4 +284,18 @@ class InstagramBridge extends BridgeAbstract {
|
|||
}
|
||||
return parent::getURI();
|
||||
}
|
||||
|
||||
public function detectParameters($url){
|
||||
$params = array();
|
||||
|
||||
// By username
|
||||
$regex = '/^(https?:\/\/)?(www\.)?instagram\.com\/([^\/?\n]+)/';
|
||||
|
||||
if(preg_match($regex, $url, $matches) > 0) {
|
||||
$params['u'] = urldecode($matches[3]);
|
||||
return $params;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue