Skip to content

Instantly share code, notes, and snippets.

@niku
Created December 1, 2013 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niku/7733891 to your computer and use it in GitHub Desktop.
Save niku/7733891 to your computer and use it in GitHub Desktop.
since: 07-30
favorite_count top 10
35 , 10-04 20:53 , 【札幌】北海道教育大・MF上原、来季加入へ http://t.co/2fhQcutl5E , https://twitter.com/consadole/status/386096635412885505
30 , 10-04 06:23 , 【札幌】前寛之、トップ昇格!クラブ初の兄弟選手誕生 http://t.co/ROr9qa89bS , https://twitter.com/consadole/status/385877695218720769
23 , 11-27 14:08 , 愛媛FC 石井 謙伍 選手 加入決定のお知らせ http://t.co/srSIiWH6Pp , https://twitter.com/consadole/status/405563675055902720
16 , 10-07 18:38 , 上原 拓郎 選手(北海道教育大学岩見沢校/コンサドーレ札幌ユース・U-18出身) 2014年シーズン 新加入内定のお知らせ http://t.co/a2m8MioHkZ , https://twitter.com/consadole/status/387149831061262336
14 , 10-05 06:23 , 【札幌】岩見沢教育大・MF上原獲得「育った札幌で」 http://t.co/jb5JLD1aaO , https://twitter.com/consadole/status/386240084896268288
13 , 08-13 11:23 , 札幌上里、J1完全移籍の打診断り残留へ http://t.co/aUN6DTUiuF , https://twitter.com/consadole/status/367109014775021568
13 , 11-24 19:53 , コンサドーレファミリーの皆様へ http://t.co/MoXkwsmjpo , https://twitter.com/consadole/status/404563324886454272
11 , 09-25 18:53 , 上里一将 選手からサポーターの皆様へ http://t.co/zd1K5zT3G5 , https://twitter.com/consadole/status/382804954882142208
11 , 10-13 14:27 , 21分 【札幌GOAL!】三上の左CKはいったんクリアされるが拾った前田が縦パスを出すと受けた神田がターンから左足を振りぬくとゴール左隅に決まる , https://twitter.com/consadole/status/389261142758924289
10 , 11-24 00:38 , 勝てばJ1昇格プレーオフ進出確実 コンサきょう札幌で北九州戦 http://t.co/ZG4QW1AMbB , https://twitter.com/consadole/status/404272653076140032
retweet_count top 10
147 , 10-04 20:53 , 【札幌】北海道教育大・MF上原、来季加入へ http://t.co/2fhQcutl5E , https://twitter.com/consadole/status/386096635412885505
140 , 11-27 14:08 , 愛媛FC 石井 謙伍 選手 加入決定のお知らせ http://t.co/srSIiWH6Pp , https://twitter.com/consadole/status/405563675055902720
110 , 10-04 06:23 , 【札幌】前寛之、トップ昇格!クラブ初の兄弟選手誕生 http://t.co/ROr9qa89bS , https://twitter.com/consadole/status/385877695218720769
71 , 11-10 17:56 , 試合終了 前半にあげたビンのPKによるゴールを守りきり1-0で勝利する , https://twitter.com/consadole/status/399460475345199105
70 , 08-18 22:38 , 8/18(日)G大阪戦におけるフェホ選手の容体について http://t.co/ovFTNrm1HF , https://twitter.com/consadole/status/369090828641128448
69 , 11-10 16:43 , 37分 【札幌GOAL!】ビンが強烈なシュートを左隅に決め先制点を奪う , https://twitter.com/consadole/status/399442154310758400
69 , 10-13 14:55 , 試合終了 札幌が神田のゴールを守り切って4回戦進出を決める , https://twitter.com/consadole/status/389268016489168896
67 , 11-03 14:55 , 試合終了 内村があげた貴重な1点を守りきり、札幌が1−0で勝利! , https://twitter.com/consadole/status/396878165907623936
60 , 08-21 13:08 , 岡山一成 選手 奈良クラブ(関西サッカーリーグ DIVISION 1)加入のお知らせ http://t.co/kmmrATCHh3 , https://twitter.com/consadole/status/370034549113122816
56 , 09-26 06:23 , 【札幌】09年戦力外の石井、再獲得へ 本人も前向き http://t.co/bc7QRLRVor , https://twitter.com/consadole/status/382978590167425024
require 'twitter'
client = Twitter::REST::Client.new do |config|
config.consumer_key = ''
config.consumer_secret = ''
config.oauth_token = ''
config.oauth_token_secret = ''
end
def timelines client, result=[]
sleep 30
p result.size
return result if (3200 <= result.size)
begin
return timelines(client, result + client.user_timeline('consadole', count: 200)) if result.empty?
timelines(client, result + client.user_timeline('consadole', count: 200, max_id: result.last.id)[1..-1])
rescue
p $!
result
end
end
ts = timelines(client)
sort_by_favorite_count = ts.sort_by(&:favorite_count).reverse
sort_by_retweet_count = ts.sort_by(&:retweet_count).reverse
File.open('consadole_tweet_stastics_result.txt', 'w') do |f|
f.write "since: #{ts.last.created_at.strftime('%m-%d')}\n"
f.write "favorite_count top 10\n"
sort_by_favorite_count.take(10).each do |t|
f.write "%3d , %s , %s , %s\n"%[t.favorite_count,
t.created_at.strftime('%m-%d %H:%M'),
t.text.gsub(/ #consadole$/, ''),
t.uri]
end
f.write "retweet_count top 10\n"
sort_by_retweet_count.take(10).each do |t|
f.write "%3d , %s , %s , %s\n"%[t.retweet_count,
t.created_at.strftime('%m-%d %H:%M'),
t.text.gsub(/ #consadole$/, ''),
t.uri]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment