[TwitterBridge] Fix issue #1621 @<twitter_user> failed with error 429 (#1622)

* [TwitterBridge] Fix issue #1621 @<twitter_user> failed with error 429
This commit is contained in:
sarnd 2020-06-25 12:21:48 +02:00 committed by GitHub
parent 23c61f5f84
commit e87b868307
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -416,10 +416,11 @@ EOD;
// Get a guest token. This is different to an API key,
// and it seems to change more regularly than the API key.
private function getGuestToken() {
$pageContent = getContents('https://twitter.com');
$pageContent = getContents('https://twitter.com', array(), array(), true);
$guestTokenRegex = '/gt=([0-9]*)/m';
preg_match_all($guestTokenRegex, $pageContent, $guestTokenMatches, PREG_SET_ORDER, 0);
preg_match_all($guestTokenRegex, $pageContent['header'], $guestTokenMatches, PREG_SET_ORDER, 0);
if (!$guestTokenMatches) returnServerError('Could not parse guest token');
$guestToken = $guestTokenMatches[0][1];
return $guestToken;
}