]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Update Twitter calls to use documented API endpoints
authorZach Copley <zach@status.net>
Fri, 17 Dec 2010 23:57:22 +0000 (15:57 -0800)
committerZach Copley <zach@status.net>
Fri, 17 Dec 2010 23:57:22 +0000 (15:57 -0800)
see: http://groups.google.com/group/twitter-api-announce/msg/34b013f4d092737f

plugins/TwitterBridge/scripts/initialize_notice_to_status.php
plugins/TwitterBridge/twitter.php
plugins/TwitterBridge/twitterimport.php
plugins/TwitterBridge/twitteroauthclient.php

index d1acfd53fa340a778befb79fed302e804e086c49..f4a60c479d62498474f45710d7aae87535126b47 100644 (file)
@@ -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);
     }
index e8d11f3b6a5cc251ef79df5d0a68c7e4af316938..a993f8ff8fcd1d3e67f5e2513988620949bde046 100644 (file)
@@ -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();
index 143543d8efa8621e3932c9b62074409e614123a5..3a4c0c43c0f1170e0b42345c81f9a36d5c0f5d69 100644 (file)
@@ -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 "<a href='https://twitter.com/search?q=%23{$tag}' class='hashtag'>{$tag}</a>";
+        return "<a href='https://search.twitter.com/search?q=%23{$tag}' class='hashtag'>{$tag}</a>";
     }
 
     static function atLink($screenName, $fullName=null)
     {
         if (!empty($fullName)) {
-            return "<a href='http://twitter.com/{$screenName}' title='{$fullName}'>{$screenName}</a>";
+            return "<a href='http://twitter.com/#!/{$screenName}' title='{$fullName}'>{$screenName}</a>";
         } else {
-            return "<a href='http://twitter.com/{$screenName}'>{$screenName}</a>";
+            return "<a href='http://twitter.com/#!/{$screenName}'>{$screenName}</a>";
         }
     }
 
index 345510a0d0b5dd4e472466a77dbd091ac01ddbfe..a17911b03eb062623e9c4bb2e5a807d4938bcd23 100644 (file)
@@ -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();