mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-17 14:18:35 +01:00
[TelegramBridge] Support new username URL format (#3257)
* [TelegramBridge] Support new username URL format * [TelegramBridge] Fix text error
This commit is contained in:
parent
06a4bc4b45
commit
67f72bfa5d
@ -22,6 +22,8 @@ class TelegramBridge extends BridgeAbstract
|
||||
'https://telegram.me/s/rssbridge' => ['username' => 'rssbridge'],
|
||||
'https://telegram.me/rssbridge' => ['username' => 'rssbridge'],
|
||||
'http://telegram.me/rssbridge' => ['username' => 'rssbridge'],
|
||||
'http://rssbridge.t.me/' => ['username' => 'rssbridge'],
|
||||
'https://rssbridge.t.me/' => ['username' => 'rssbridge'],
|
||||
];
|
||||
|
||||
const CACHE_TIMEOUT = 60 * 15; // 15 mins
|
||||
@ -360,10 +362,17 @@ EOD;
|
||||
|
||||
public function detectParameters($url)
|
||||
{
|
||||
$detectParamsRegex = '/^https?:\/\/(?:t|telegram)\.me\/(?:s\/)?([\w]+)$/';
|
||||
$detectParamsRegex = '/^https?:\/\/(?:(?:t|telegram)\.me\/(?:s\/)?([\w]+)|([\w]+)\.t\.me\/?)$/';
|
||||
$params = [];
|
||||
if (preg_match($detectParamsRegex, $url, $matches) > 0) {
|
||||
$params['username'] = $matches[1];
|
||||
if ($matches[1] !== '') {
|
||||
$params['username'] = $matches[1];
|
||||
}
|
||||
|
||||
if (isset($matches[2]) && $matches[2] !== '') {
|
||||
$params['username'] = $matches[2];
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user