From: Zach Copley Date: Fri, 17 Dec 2010 23:57:22 +0000 (-0800) Subject: Update Twitter calls to use documented API endpoints X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=073f3e99;p=quix0rs-gnu-social.git Update Twitter calls to use documented API endpoints see: http://groups.google.com/group/twitter-api-announce/msg/34b013f4d092737f --- diff --git a/plugins/TwitterBridge/scripts/initialize_notice_to_status.php b/plugins/TwitterBridge/scripts/initialize_notice_to_status.php index d1acfd53fa..f4a60c479d 100644 --- a/plugins/TwitterBridge/scripts/initialize_notice_to_status.php +++ b/plugins/TwitterBridge/scripts/initialize_notice_to_status.php @@ -44,7 +44,7 @@ $n->query('SELECT notice.id, notice.uri ' . 'AND notice_to_status.status_id IS NULL'); while ($n->fetch()) { - if (preg_match('#^http://twitter.com/[\w_.]+/status/(\d+)$#', $n->uri, $match)) { + if (preg_match('/^http://twitter.com(/#!)?/[\w_.]+/status/(\d+)$/', $n->uri, $match)) { $status_id = $match[1]; Notice_to_status::saveNew($n->id, $status_id); } diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index e8d11f3b6a..a993f8ff8f 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -45,7 +45,7 @@ function add_twitter_user($twitter_id, $screen_name) $fuser = new Foreign_user(); $fuser->nickname = $screen_name; - $fuser->uri = 'http://twitter.com/' . $screen_name; + $fuser->uri = 'http://twitter.com/#!/' . $screen_name; $fuser->id = $twitter_id; $fuser->service = TWITTER_SERVICE; $fuser->created = common_sql_now(); diff --git a/plugins/TwitterBridge/twitterimport.php b/plugins/TwitterBridge/twitterimport.php index 143543d8ef..3a4c0c43c0 100644 --- a/plugins/TwitterBridge/twitterimport.php +++ b/plugins/TwitterBridge/twitterimport.php @@ -207,7 +207,7 @@ class TwitterImport */ function makeStatusURI($username, $id) { - return 'http://twitter.com/' + return 'http://twitter.com/#!/' . $username . '/status/' . $id; @@ -264,7 +264,7 @@ class TwitterImport function ensureProfile($user) { // check to see if there's already a profile for this user - $profileurl = 'http://twitter.com/' . $user->screen_name; + $profileurl = 'http://twitter.com/#!/' . $user->screen_name; $profile = $this->getProfileByUrl($user->screen_name, $profileurl); if (!empty($profile)) { @@ -618,15 +618,15 @@ class TwitterImport static function tagLink($tag) { - return "{$tag}"; + return "{$tag}"; } static function atLink($screenName, $fullName=null) { if (!empty($fullName)) { - return "{$screenName}"; + return "{$screenName}"; } else { - return "{$screenName}"; + return "{$screenName}"; } } diff --git a/plugins/TwitterBridge/twitteroauthclient.php b/plugins/TwitterBridge/twitteroauthclient.php index 345510a0d0..a17911b03e 100644 --- a/plugins/TwitterBridge/twitteroauthclient.php +++ b/plugins/TwitterBridge/twitteroauthclient.php @@ -43,10 +43,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { */ class TwitterOAuthClient extends OAuthClient { - public static $requestTokenURL = 'https://twitter.com/oauth/request_token'; - public static $authorizeURL = 'https://twitter.com/oauth/authorize'; - public static $signinUrl = 'https://twitter.com/oauth/authenticate'; - public static $accessTokenURL = 'https://twitter.com/oauth/access_token'; + public static $requestTokenURL = 'https://api.twitter.com/oauth/request_token'; + public static $authorizeURL = 'https://api.twitter.com/oauth/authorize'; + public static $signinUrl = 'https://api.twitter.com/oauth/authenticate'; + public static $accessTokenURL = 'https://api.twitter.com/oauth/access_token'; /** * Constructor @@ -157,7 +157,7 @@ class TwitterOAuthClient extends OAuthClient */ function verifyCredentials() { - $url = 'https://twitter.com/account/verify_credentials.json'; + $url = 'https://api.twitter.com/1/account/verify_credentials.json'; $response = $this->oAuthGet($url); $twitter_user = json_decode($response); return $twitter_user; @@ -175,7 +175,7 @@ class TwitterOAuthClient extends OAuthClient */ function statusesUpdate($status, $params=array()) { - $url = 'https://twitter.com/statuses/update.json'; + $url = 'https://api.twitter.com/1/statuses/update.json'; if (is_numeric($params)) { $params = array('in_reply_to_status_id' => intval($params)); } @@ -200,7 +200,7 @@ class TwitterOAuthClient extends OAuthClient function statusesHomeTimeline($since_id = null, $max_id = null, $cnt = null, $page = null) { - $url = 'https://twitter.com/statuses/home_timeline.json'; + $url = 'https://api.twitter.com/1/statuses/home_timeline.json'; $params = array('include_entities' => 'true'); @@ -235,7 +235,7 @@ class TwitterOAuthClient extends OAuthClient function statusesFriends($id = null, $user_id = null, $screen_name = null, $page = null) { - $url = "https://twitter.com/statuses/friends.json"; + $url = "https://api.twitter.com/1/statuses/friends.json"; $params = array(); @@ -273,7 +273,7 @@ class TwitterOAuthClient extends OAuthClient function friendsIds($id = null, $user_id = null, $screen_name = null, $page = null) { - $url = "https://twitter.com/friends/ids.json"; + $url = "https://api.twitter.com/1/friends/ids.json"; $params = array();