2016-03-31 4 views
0

https://api.twitter.com/1.1/statuses/user_timeline.jsonを使用して収集されたquoted_statusに、「retweet of tomgabi https:// ...」というテキストがあるとします。このリンクをブラウザで開くと、ユーザーに関する多くの情報(tweet、screen_name、descriptionなど)を見ることができます。 URLはhttps://twitter.com/wiltonpfilho/status/715320170655440896に変更されます。 Twitter APIを使用して、この新しいURLのユーザー情報(tweet、screen_name、descriptionなど)を取得するにはどうすればよいですか。 id_str(URL)からユーザー情報にアクセスできますか?Twitter APIを使用してid_strからユーザー情報(screen_name、descriptionなど)を取得するにはどうすればよいですか?

答えて

0

Check this Link

だから、本当にもう、このクライアント側を行うにはしたくありません。 (ただ、数多くのドキュメントを経て、そして開発者は、すべてのOAuthサーバー側を行うことをお勧め)

あなたがする必要がどのような:

まずhttps://dev.twitter.comにサインアップして、新しいアプリケーションを作ります。

第二は:注:お使いのコンシューマーキー/秘密アクセストークンと一緒に/秘密

サード:この場合、私はPHPライブラリhttps://github.com/abraham/twitteroauth、ここにある追加のライブラリを使用する(TwitterのOAuthのライブラリをダウンロード:https://dev.twitter.com/docs/twitter-libraries

第四:(PHPを使用している場合)LAMP上のあなたのランニングは、ここにあなたが必要なコマンドの場合は、必ずcURLのが有効にされていることを確認:

sudo apt-get install php5-curl 

フィフス:新しいPHPファイルを作成し、以下を挿入します。トム・エリオットのおかげhttp://www.webdevdoor.com/php/authenticating-twitter-feed-timeline-oauth/

<?php 
session_start(); 
require_once("twitteroauth/twitteroauth/twitteroauth.php"); //Path to twitteroauth library you downloaded in step 3 

$twitteruser = "twitterusername"; //user name you want to reference 
$notweets = 30; //how many tweets you want to retrieve 
$consumerkey = "12345"; //Noted keys from step 2 
$consumersecret = "123456789"; //Noted keys from step 2 
$accesstoken = "123456789"; //Noted keys from step 2 
$accesstokensecret = "12345"; //Noted keys from step 2 

function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) { 
    $connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret); 
    return $connection; 
} 

$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret); 

$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets); 

echo json_encode($tweets); 
echo $tweets; //testing remove for production 
?> 

とブームは、あなたが行われています。 これは純粋なjsソリューションではありませんが、新しいTwitter API 1.1ドキュメントを再度読んで、本当にこのクライアントサイトをやりたがりません。このが役立つことを願っています!

0

statuses/lookupを使用してください。例えば、https://api.twitter.com/1.1/statuses/lookup.json?id=715320170655440896

関連する問題