[TwitterBridge] URL to js file with apikey changed. (#1686)
Twitter has changed URL scheme back again (see PR#1647 / commit 78298385d0
)
This patch will try both URL schemes now and throw a specific error when neither works
This commit is contained in:
parent
5be251a66e
commit
c71fad4a4a
1 changed files with 8 additions and 1 deletions
|
@ -377,8 +377,15 @@ EOD;
|
||||||
if($data === null || (time() - $refresh) > self::GUEST_TOKEN_EXPIRY) {
|
if($data === null || (time() - $refresh) > self::GUEST_TOKEN_EXPIRY) {
|
||||||
$twitterPage = getContents('https://twitter.com');
|
$twitterPage = getContents('https://twitter.com');
|
||||||
|
|
||||||
$jsMainRegex = '/(https:\/\/abs\.twimg\.com\/responsive-web\/web_legacy\/main\.[^\.]+\.js)/m';
|
$jsMainRegex = '/(https:\/\/abs\.twimg\.com\/responsive-web\/web\/main\.[^\.]+\.js)/m';
|
||||||
preg_match_all($jsMainRegex, $twitterPage, $jsMainMatches, PREG_SET_ORDER, 0);
|
preg_match_all($jsMainRegex, $twitterPage, $jsMainMatches, PREG_SET_ORDER, 0);
|
||||||
|
if (!$jsMainMatches) {
|
||||||
|
$jsMainRegex = '/(https:\/\/abs\.twimg\.com\/responsive-web\/web_legacy\/main\.[^\.]+\.js)/m';
|
||||||
|
preg_match_all($jsMainRegex, $twitterPage, $jsMainMatches, PREG_SET_ORDER, 0);
|
||||||
|
}
|
||||||
|
if (!$jsMainMatches) {
|
||||||
|
returnServerError('Could not locate main.js link');
|
||||||
|
}
|
||||||
$jsLink = $jsMainMatches[0][0];
|
$jsLink = $jsMainMatches[0][0];
|
||||||
|
|
||||||
$jsContent = getContents($jsLink);
|
$jsContent = getContents($jsLink);
|
||||||
|
|
Loading…
Reference in a new issue