From f5916a2f74e3679124e0433bb0d7e5e3c63e0cbf Mon Sep 17 00:00:00 2001 From: triatic <42704418+triatic@users.noreply.github.com> Date: Thu, 30 Jul 2020 05:54:16 +0100 Subject: [PATCH] [TwitterBridge] apikey fetched every time (#1663) The apikey is fetched every time because $data is not an array. Update the condition to expire the api key at the same time as the guest token. --- bridges/TwitterBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index a38479d4..e4c44752 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -374,7 +374,7 @@ EOD; $data = $cache->loadData(); $apiKey = null; - if($data === null || !is_array($data) || count($data) != 1) { + if($data === null || (time() - $refresh) > self::GUEST_TOKEN_EXPIRY) { $twitterPage = getContents('https://twitter.com'); $jsMainRegex = '/(https:\/\/abs\.twimg\.com\/responsive-web\/web_legacy\/main\.[^\.]+\.js)/m';