Sha256: df60d2041aeafb9ca23ea91c130ebde333313cfa46dc094507cb8a3078944da1
Contents?: true
Size: 711 Bytes
Versions: 2
Compression:
Stored size: 711 Bytes
Contents
require "open-uri" require "hpricot" # Grabs the headline of Wikipedia's Today's Featured Article (TFA) module Twuckoo class WikipediaTFA WIKIPEDIA_HOST = "http://en.wikipedia.org" def setup end def load_tweets; end def store(line); end def reset; end def fetch_main_page Hpricot(open("#{WIKIPEDIA_HOST}/wiki/Main_Page")) end def fetch_tfa doc = fetch_main_page tfa = doc.at("#mp-tfa b a") tfa_link = WIKIPEDIA_HOST + tfa["href"] "#{tfa.inner_html}: #{tfa_link}" end def next prev_tweet = twitter_module.latest_tweet(config) next_tweet = fetch_tfa prev_tweet == next_tweet ? '' : next_tweet end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twuckoo-0.5.3 | lib/twuckoo/feeders/wikipedia_tfa.rb |
twuckoo-0.5.2 | lib/twuckoo/feeders/wikipedia_tfa.rb |