Skip to content

Instantly share code, notes, and snippets.

@kachick
Created May 22, 2012 05:01
Show Gist options
  • Select an option

  • Save kachick/2766723 to your computer and use it in GitHub Desktop.

Select an option

Save kachick/2766723 to your computer and use it in GitHub Desktop.
昔でっち上げた物 - OCNの故障情報を持ってくるスクレイパ
#!/usr/bin/ruby -w
require 'rss'
require 'open-uri'
require 'time/unit'
require 'time/unit/import'
TODAY = Time.now
PROXY = 'http://localhost:8888/'
HOW_LONG_DAYS = Time.Unit(Integer(ARGV[0] || 7), :day)
open 'http://www.ocn.ad.jp/tw/rss/TechRSS11.rdf', proxy: PROXY do |page|
rss = RSS::Parser.parse page
rss.items.each do |item|
if (TODAY - item.date) <= HOW_LONG_DAYS
puts item.title, item.description, '***'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment