X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Ftwitterstatusfetcher.php;h=3cdf1867a197319c486d61bab7c19d8edf735fd8;hb=ed2e49477d43bce71c492e8dda65682e8e7863a6;hp=68f7e9bf758cee4d73ffde0a59b191818b188717;hpb=bbb830e14c718c687f0636710a1827c90b11f4cc;p=quix0rs-gnu-social.git diff --git a/scripts/twitterstatusfetcher.php b/scripts/twitterstatusfetcher.php index 68f7e9bf75..3cdf1867a1 100755 --- a/scripts/twitterstatusfetcher.php +++ b/scripts/twitterstatusfetcher.php @@ -148,9 +148,9 @@ class TwitterStatusFetcher extends ParallelizingDaemon function getTimeline($flink) { - if (empty($flink)) { + if (empty($flink)) { common_log(LOG_WARNING, $this->name() . - " - Can't retrieve Foreign_link for foreign ID $fid"); + " - Can't retrieve Foreign_link for foreign ID $fid"); return; } @@ -161,17 +161,24 @@ class TwitterStatusFetcher extends ParallelizingDaemon // to start importing? How many statuses? Right now I'm going // with the default last 20. - $token = TwitterOAuthClient::unpackToken($flink->credentials); + $client = null; - $client = new TwitterOAuthClient($token->key, $token->secret); + if (TwitterOAuthClient::isPackedToken($flink->credentials)) { + $token = TwitterOAuthClient::unpackToken($flink->credentials); + $client = new TwitterOAuthClient($token->key, $token->secret); + common_debug($this->name() . ' - Grabbing friends timeline with OAuth.'); + } else { + $client = new TwitterBasicAuthClient($flink); + common_debug($this->name() . ' - Grabbing friends timeline with basic auth.'); + } $timeline = null; try { $timeline = $client->statusesFriendsTimeline(); - } catch (OAuthClientCurlException $e) { + } catch (Exception $e) { common_log(LOG_WARNING, $this->name() . - ' - OAuth client unable to get friends timeline for user ' . + ' - Twitter client unable to get friends timeline for user ' . $flink->user_id . ' - code: ' . $e->getCode() . 'msg: ' . $e->getMessage()); }