Created
May 22, 2012 05:01
-
-
Save kachick/2766723 to your computer and use it in GitHub Desktop.
昔でっち上げた物 - OCNの故障情報を持ってくるスクレイパ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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