Skip to content
This repository has been archived by the owner. It is now read-only.
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
# Track public available information of a twitter user like follower, follower
# and tweet count by scraping the user profile page.
# Config
# ------
twitter_username = ENV['TWITTER_USERNAME'] || 'foobugs'
SCHEDULER.every '2m', :first_in => 0 do |job|
doc = Nokogiri::HTML(open("{twitter_username}"))
tweets = doc.css('a[data-nav=tweets]').first.attributes['title'].value.split(' ').first
followers = doc.css('a[data-nav=followers]').first.attributes['title'].value.split(' ').first
following = doc.css('a[data-nav=following]').first.attributes['title'].value.split(' ').first
send_event('twitter_user_tweets', current: tweets)
send_event('twitter_user_followers', current: followers)
send_event('twitter_user_following', current: following)