-1

次のphpコードを使用して、ユーザーのTwitterフォロワーを取得します。このデータをcsvファイルにエクスポートし、100人を超えるフォロワーを持つフォロワーのみを保存するフィルターを追加したいと思います。

<script src="http://code.jquery.com/jquery-latest.js"></script>

<?php
  $trends_url = "http://api.twitter.com/1/statuses/followers/pthiongo.json";
  $ch = curl_init(); 
  curl_setopt($ch, CURLOPT_URL, $trends_url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $curlout = curl_exec($ch);
  curl_close($ch);
  $response = json_decode($curlout, true);
  foreach($response as $friends){
  $thumb = $friends['profile_image_url'];
  $url = $friends['screen_name'];
  $name = $friends['name'];
  echo $friends['screen_name'];

 ?>
<a title="<?php echo $name;?>" href="http://www.twitter.com/<?php echo $url;?>"><img class="photo-img" src="<?    php echo $thumb?>" border="0" alt="" width="40" /></a>
<?php
 } 
?>
4

2 に答える 2

1

まずこれ、 http://blog.gabrieleromanato.com/2012/06/jquery-get-twitter-followers-count/

次にif (followers_count > 99) 、PHPでを使用して表示します

于 2012-09-29T18:50:28.707 に答える
0

プログラムでは、以下のサンプルリクエストを使用して、InstagramAPIで最大100人のフォロワーのリストをリクエストできます。

以下のサンプルリクエストはSnippetLibからのものです。

https:api.instagram.comv1users3followed-by?access_token=ACCESS-TOKEN

このルート(nbyim.comから)は、ページ付けを使用してレート制限を回避します。

from instagram.client import InstagramAPI

user_id=''
access_token = ''
client_secret = ''

api = InstagramAPI(access_token=access_token, client_secret=client_secret)

followers = []

# Get the followers list
for p in api.user_followed_by(user_id=user_id, as_generator=True, max_pages=None):
followers.extend(p[0])

# Convert from an instagram.models.User list to a list of strings
followers = [str(u).replace('User: ', '') for u in followers]

print len(followers), 'followers'
print followers

CSVプロセスを自動化するには、Crowdbabbleのようなサービスを使用できます:https ://www.crowdbabble.com/download-all-instagram-followers/

于 2016-09-12T19:27:31.700 に答える