diff options
author | Francis Irving <francis@mysociety.org> | 2010-07-20 23:01:04 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-07-20 23:01:04 +0100 |
commit | 13ddc27f5f2cad60a607a8b79c91ebcc5d9e5717 (patch) | |
tree | 5c3de6b665aef2e57a97fb89820ed453e6c194c7 /app/controllers/general_controller.rb | |
parent | ebe22e83749923acbbf8b8957edd85ce2ea7d1c0 (diff) |
Include tweets
Diffstat (limited to 'app/controllers/general_controller.rb')
-rw-r--r-- | app/controllers/general_controller.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index efab26fad..3bf113efb 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -49,14 +49,22 @@ class GeneralController < ApplicationController # Display WhatDoTheyKnow category from mySociety blog def blog feed_url = 'http://www.mysociety.org/category/projects/whatdotheyknow/feed/' - all_url = 'http://www.mysociety.org/category/projects/whatdotheyknow/' - @output = '' content = open(feed_url).read @data = XmlSimple.xml_in(content) @channel = @data['channel'][0] @items = @channel['item'] - @feed_autodetect = [ { :url => @channel['link'][0]['href'], :title => "WhatDoTheyKnow blog"} ] + @feed_autodetect = [ { :url => feed_url, :title => "WhatDoTheyKnow blog"} ] + + twitter_url = 'http://api.twitter.com/1/statuses/user_timeline/whatdotheyknow.rss' # @whatdotheyknow + content = open(twitter_url).read + @data = XmlSimple.xml_in(content) + @channel = @data['channel'][0] + @items = @channel['item'] + @items + + @feed_autodetect += [ { :url => twitter_url, :title => "WhatDoTheyKnow tweets"} ] + + @items.sort! { |a,b| Time.parse(b['pubDate'][0]) <=> Time.parse(a['pubDate'][0]) } end # Just does a redirect from ?query= search to /query |