Add support for mobile profile URL to core twitter probing

This commit is contained in:
Hypolite Petovan 2020-06-24 21:07:49 -04:00
parent 50d05cec83
commit 2c2db55298
1 changed files with 6 additions and 4 deletions

View File

@ -692,7 +692,7 @@ class Probe
$parts = parse_url($uri);
if (!empty($parts['scheme']) && !empty($parts['host'])) {
if ($parts['host'] == 'twitter.com') {
if (in_array($parts['host'], ['twitter.com', 'mobile.twitter.com'])) {
return self::twitter($uri);
}
} elseif (strstr($uri, '@')) {
@ -706,7 +706,9 @@ class Probe
return self::mail($uri, $uid);
}
if (strpos($uri, '@twitter.com')) {
if (Strings::endsWith($uri, '@twitter.com')
|| Strings::endsWith($uri, '@mobile.twitter.com')
) {
return self::twitter($uri);
}
} else {
@ -1720,9 +1722,9 @@ class Probe
*/
private static function twitter($uri)
{
if (preg_match('=(.*)@twitter.com=i', $uri, $matches)) {
if (preg_match('=([^@]+)@(?:mobile\.)?twitter\.com$=i', $uri, $matches)) {
$nick = $matches[1];
} elseif (preg_match('=https?://twitter.com/(.*)=i', $uri, $matches)) {
} elseif (preg_match('=^https?://(?:mobile\.)?twitter\.com/(.+)=i', $uri, $matches)) {
$nick = $matches[1];
} else {
return [];