HTML Twitter Friends Widget v2.0 - jQuery插件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTML Twitter Friends Widget v2.0 - jQuery插件相关的知识,希望对你有一定的参考价值。

<!-- Include javascript and CSS once -->
<link href="http://twitter-friends-widget.googlecode.com/svn/v2/light.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://twitter-friends-widget.googlecode.com/files/jquery.twitter-friends-2.0.min.js" type="text/javascript"></script>

<!-- Required HTML -->
<div class="twitter-friends" data-options="{ username:'Mike_More' }">
   <a class="tfw-info" href="http://www.moretechtips.net" target="_blank">Twitter Friends/Followers Widget</a>
</div>
<!-- Required HTML -->

ruby Twitter的friends.rb

require 'csv'
require 'twitter'

def twitter_client
  @twitter_client ||= Twitter::REST::Client.new do |config|
    config.consumer_key = 'XXXXXX'
    config.consumer_secret = 'XXXXXX'
    config.access_token = 'XXXXXX'
    config.access_token_secret = 'XXXXXX'
  end
end

SLICE_SIZE = 100

def fetch_all_friends(twitter_username)
  CSV.open("#{twitter_username}_friends_list.txt", 'w') do |csv|
    twitter_client.friend_ids(twitter_username).each_slice(SLICE_SIZE).with_index do |slice, i|
      twitter_client.users(slice).each_with_index do |f, j|
        csv << [i * SLICE_SIZE + j + 1, f.name, f.screen_name, f.url, f.followers_count, f.location.gsub(/\n+/, ' '), f.created_at, f.description.gsub(/\n+/, ' '), f.lang, f.time_zone, f.verified, f.profile_image_url, f.website, f.statuses_count, f.profile_background_image_url, f.profile_banner_url]
      end
    end
  end
end

fetch_all_friends("screen_name_of_twitter_user")

以上是关于HTML Twitter Friends Widget v2.0 - jQuery插件的主要内容,如果未能解决你的问题,请参考以下文章

python check_twitter_friends_last_tweet_date.py

使用PHP获取您最近的Twitter状态

Twitter好友小工具v2.0-jQuery插件

jQuery getJSON 函数

Attitude Towards Friends

ZOJ 3706 Friends