mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 17:45:40 +03:00
[VkBridge] Add detectParameters (#3351)
This commit is contained in:
parent
0718fdc829
commit
7c4591c550
1 changed files with 18 additions and 0 deletions
|
@ -22,9 +22,18 @@ class VkBridge extends BridgeAbstract
|
|||
]
|
||||
]
|
||||
];
|
||||
const TEST_DETECT_PARAMETERS = [
|
||||
'https://vk.com/id1' => ['u' => 'id1'],
|
||||
'https://vk.com/groupname' => ['u' => 'groupname'],
|
||||
'https://m.vk.com/groupname' => ['u' => 'groupname'],
|
||||
'https://vk.com/groupname/anythingelse' => ['u' => 'groupname'],
|
||||
'https://vk.com/groupname?w=somethingelse' => ['u' => 'groupname'],
|
||||
'https://vk.com/with_underscore' => ['u' => 'with_underscore'],
|
||||
];
|
||||
|
||||
protected $pageName;
|
||||
protected $tz = 0;
|
||||
private $urlRegex = '/vk\.com\/([\w]+)/';
|
||||
|
||||
public function getURI()
|
||||
{
|
||||
|
@ -44,6 +53,15 @@ class VkBridge extends BridgeAbstract
|
|||
return parent::getName();
|
||||
}
|
||||
|
||||
public function detectParameters($url)
|
||||
{
|
||||
if (preg_match($this->urlRegex, $url, $matches)) {
|
||||
return ['u' => $matches[1]];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
$text_html = $this->getContents();
|
||||
|
|
Loading…
Reference in a new issue