Skip to content

Commit 67f72bf

Browse files
[TelegramBridge] Support new username URL format (RSS-Bridge#3257)
* [TelegramBridge] Support new username URL format * [TelegramBridge] Fix text error
1 parent 06a4bc4 commit 67f72bf

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

bridges/TelegramBridge.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class TelegramBridge extends BridgeAbstract
2222
'https://telegram.me/s/rssbridge' => ['username' => 'rssbridge'],
2323
'https://telegram.me/rssbridge' => ['username' => 'rssbridge'],
2424
'http://telegram.me/rssbridge' => ['username' => 'rssbridge'],
25+
'http://rssbridge.t.me/' => ['username' => 'rssbridge'],
26+
'https://rssbridge.t.me/' => ['username' => 'rssbridge'],
2527
];
2628

2729
const CACHE_TIMEOUT = 60 * 15; // 15 mins
@@ -360,10 +362,17 @@ private function normalizeUsername()
360362

361363
public function detectParameters($url)
362364
{
363-
$detectParamsRegex = '/^https?:\/\/(?:t|telegram)\.me\/(?:s\/)?([\w]+)$/';
365+
$detectParamsRegex = '/^https?:\/\/(?:(?:t|telegram)\.me\/(?:s\/)?([\w]+)|([\w]+)\.t\.me\/?)$/';
364366
$params = [];
365367
if (preg_match($detectParamsRegex, $url, $matches) > 0) {
366-
$params['username'] = $matches[1];
368+
if ($matches[1] !== '') {
369+
$params['username'] = $matches[1];
370+
}
371+
372+
if (isset($matches[2]) && $matches[2] !== '') {
373+
$params['username'] = $matches[2];
374+
}
375+
367376
return $params;
368377
}
369378
return null;

0 commit comments

Comments
 (0)