Skip to content

Instantly share code, notes, and snippets.

@jirutka
Created September 20, 2015 21:38
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 jirutka/99cc00f23f10debc7c53 to your computer and use it in GitHub Desktop.
Save jirutka/99cc00f23f10debc7c53 to your computer and use it in GitHub Desktop.
Twitter statistics for #WebExpo 2015

Twitter statistics for #WebExpo 2015

  • Number of tweets (excluding RTs): 1139

  • Number of favourites: 2804

  • Number of retweets: 1090

  • Number of tweeting users: 341

TOP tweeting users

List of most active users sorted by number of their tweets with hashtag #WebExpo.

Rank User(s) Tweets

1.

@webexpo

55

2.

@imrichl

40

3.

@Dzulaya

37

4.

@BoBMarvan

28

5.

@janjadud

19

6.

@iKristy

18

7.

@PavelUngr, @Pavlina_speaks, @avast_antivirus, @jirihelmich, @tesino82

17

8.

@faxecz

16

9.

@ProductivityTOP, @dmelich, @pp2tech

15

10.

@JakubJirutka, @MichalAndera

14

TOP favourited tweets

Rank Tweet(s) Favourites

1.

@robinpokorny: O #webexpo se mluví na ČT24! Akorát by jim měli říct, že je to "on-line". http://t.co/1i341MZBll

48

2.

@otecfura: Právě jsem se někomu na záchodě podíval na penis a usmál se. A pak že jsou lidi od IT asociálové. #webexpo

36

3.

@JirkaCh: #Webexpo je vývojářská konference a je na něm vidět, jak se mění oblékání mužů v #IT. Více košil a sak, méně vytahaných triček #webexpo2015

27

4.

@ZdenekLanc: Na webu @CzechTV dnes streamujeme vybrané #webexpo talks! http://t.co/t0ncCrLBOy #webexpo2015

26

5.

@atpok: Jestli vás zaujal @jirijerabek testováním konceptů v BBC, tady si ještě přečtěte: http://t.co/RBgUI0ipIj #webexpo

@faxecz: "…​ a tohle, co mi rikate, to je fakt, nebo si to myslite?" Dulezita otazka na klienta! Petr Šídlo na #webexpo

@filippodstavec: "Správný analytik vždycky najde graf, který roste" #truestory #webexpo by @VojtaRocek

22

6.

@signalizer: ~1700 visitors, 17+ awesome design talks, tons of caffeine consumed. Tired, proud and happy. Thanks!

☑ #webexpo 2015 http://t.co/TbdUGgGkcY

20

7.

@adactio: My floating head looms above @Anna_Debenham’s #WebExpo presentation. http://t.co/khbXL1u7cZ

19

8.

@PavelUngr: Přednáška mela být v češtině, ale prý resérčři dělají kastmr a jůzr rýsérč, aby dosáhli valjejbl biznys. Tak vám nevím :-) #webexpo

18

9.

@BoBMarvan: A framework k testování konceptů od @JiriJerabek bude na http://t.co/fxL8UpKB8k #webexpo

16

10.

@madciapka: Raňajky na #webexpo majú dosť vysoký hipster index :-) http://t.co/h8JUISLo2N

@filiphracek: Líbila se vám moje #webexpo přednáška? Dejte si ji ještě jednou, bez mých hloupých keců. https://t.co/4GJ9EqYTeE

@Michelle_LSKT: Rozhovor @annaud a @SarkaStrossova shrnuje #webexpo: A: Šárko, taks neumřela! Š: Já to nestihla!

15

TOP retweeted tweets

Rank Tweet(s) Retweets

1.

@ZdenekLanc: Na webu @CzechTV dnes streamujeme vybrané #webexpo talks! http://t.co/t0ncCrLBOy #webexpo2015

24

2.

@robinpokorny: O #webexpo se mluví na ČT24! Akorát by jim měli říct, že je to "on-line". http://t.co/1i341MZBll

22

3.

@izatlouk: Na včerejší #webexpo party jsem přišla o fitbit. Nenašla jej nějaká dobrá duše mezi vámi? Značka ztráty a nálezy…​

15

4.

@schambep: Studenti @stunome spolupracovali na novem developerskeho portalu CS https://t.co/74wsgFZf7r @csas_devs #webexpo #api http://t.co/olAunsizQG

14

5.

@dejfnn: Data znamenají víc než názory @paunikar #webexpo

@atpok: Jestli vás zaujal @jirijerabek testováním konceptů v BBC, tady si ještě přečtěte: http://t.co/RBgUI0ipIj #webexpo

11

6.

@filippodstavec: "Správný analytik vždycky najde graf, který roste" #truestory #webexpo by @VojtaRocek

10

7.

@faxecz: "…​ a tohle, co mi rikate, to je fakt, nebo si to myslite?" Dulezita otazka na klienta! Petr Šídlo na #webexpo

@webexpo: “Bad news! If you are not passionate enough, you’ll quit one day. Remember this.” Dominika Blackappl #webexpo

9

8.

@codeas: Vizualizace nejvytíženějších poboček @Ceskasporitelna http://t.co/JsTsYuOaeZ #webexpo #webapi @csas_devs @jansechovec http://t.co/zOJibOxcq6

@janmelvil: TIP: Využijte kuponu WEBEXPO15 v našem eshopu (http://t.co/vaON4ObYtV). Dosáhnete cca 30% slevy! Vyprší dnes o půlnoci. #webexpo @webexpo

@divani: "Krátkodobé ciele vám neprinesú šťastie. Vyberajte si prácu, s ktorou môžete zmeniť svet." Dominka Blackappl na #webexpo

8


Generated on 2015-09-20 23:27:03 +0200.

#!/usr/bin/env ruby
#
# Quick & dirty script to generate some Twitter statistics for events.
#
# Usage:
# 1. gem install twitter
# 2. Register your “app” on https://apps.twitter.com/apps and set OAuth
# credentials here.
# 3. Profit!
#
# License:
# Creative Commons CC-Zero This file is made available under the Creative
# Commons CC0 1.0 Universal Public Domain Dedication.
# https://creativecommons.org/publicdomain/zero/1.0/deed.en
require 'ostruct'
require 'twitter'
######## Configuration ########
HASHTAG = '#WebExpo'
DATE_FROM = '2015-09-18'
DATE_TO = '2015-09-21'
USERS_LIST_LIMIT = 10
FAVORITES_LIST_LIMIT = 10
RETWEETS_LIST_LIMIT = 8
client = Twitter::REST::Client.new do |config|
config.consumer_key = 'YOUR_CONSUMER_KEY'
config.consumer_secret = 'YOUR_CONSUMER_SECRET'
config.access_token = 'YOUR_ACCESS_TOKEN'
config.access_token_secret = 'YOUR_ACCESS_SECRET'
end
year = DATE_FROM.split('-').first
######## Functions ########
def top_tweets_by(field, tweets)
tweets.lazy
.group_by { |tw| tw.public_send(field) }
.sort.reverse
.map { |count, tweets| [count, tweets.sort_by(&:created_at)] }
end
def top_users_by_tweets_count(tweets)
tweets.lazy
.group_by(&:user)
.map { |user, tweets| [user, tweets.count] }
.group_by(&:last) # group by number of tweets
.sort.reverse
.map { |count, tuples| [count, tuples.map(&:first)] } # extract users as value of the entry
.map { |count, users| [count, users.sort_by(&:screen_name)] }
end
def title(level, text)
puts "\n\n#{'=' * level} #{text}\n\n"
end
def table(headers, data, &block)
lines = ['|===', '| ' + headers.join(' | '), '']
data.each_with_index do |item, idx|
(yield item, idx + 1).each do |col|
lines << "| #{col}"
end
lines << ''
end
lines << '|===' << ''
puts lines.join("\n")
end
format_user = ->(user) { "#{user.uri}[@#{user.screen_name}] (#{user.followers_count})" }
format_tweet = ->(tweet) { "@#{tweet.user.screen_name}: #{tweet.uri}[#{tweet.text}]" }
######## Main ########
tweets = client.search("#{HASHTAG} since:#{DATE_FROM} until:#{DATE_TO}", result_type: :all)
.reject { |tweet| tweet.retweet? }
users = tweets.map(&:user).uniq
favourites_count = tweets.map(&:favorite_count).reduce(:+)
retweets_count = tweets.map(&:retweet_count).reduce(:+)
top_users = top_users_by_tweets_count(tweets).take(USERS_LIST_LIMIT)
top_favorites = top_tweets_by(:favorite_count, tweets).take(FAVORITES_LIST_LIMIT)
top_retweets = top_tweets_by(:retweet_count, tweets).take(RETWEETS_LIST_LIMIT)
# Print report in AsciiDoc
title 1, "Twitter statistics for #{HASHTAG} #{year}"
puts "* Number of tweets (excluding RTs): #{tweets.count}"
puts "* Number of favourites: #{favourites_count}"
puts "* Number of retweets: #{retweets_count}"
puts "* Number of tweeting users: #{users.count}"
title 2, 'TOP tweeting users'
puts "List of most active users sorted by number of their tweets with hashtag #{HASHTAG}.\n\n"
table ['Rank', 'User(s)', 'Tweets'], top_users do |(count, users), idx|
["#{idx}.", users.map(&format_user).join(', '), count]
end
title 2, 'TOP favourited tweets'
table ['Rank', 'Tweet(s)', 'Favourites'], top_favorites do |(count, tweets), idx|
["#{idx}.", tweets.map(&format_tweet).join("\n\n"), count]
end
title 2, 'TOP retweeted tweets'
table ['Rank', 'Tweet(s)', 'Retweets'], top_retweets do |(count, tweets), idx|
["#{idx}.", tweets.map(&format_tweet).join("\n\n"), count]
end
puts "\n\n''''"
puts "_Generated on #{Time.now}._"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment