- Timestamp:
- 09/04/08 14:23:55 (4 months ago)
- Location:
- lang/ruby/echola
- Files:
-
- 2 modified
-
hatenahaiku-download.rb (modified) (1 diff)
-
hatenastar-rss-download.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/echola/hatenahaiku-download.rb
r18760 r18827 11 11 source = ARGV[0] || 'http://h.hatena.ne.jp/api/statuses/public_timeline.json' 12 12 dbfile = ARGV[1] || "#{here}/hatenahaiku-public.db" 13 open(source) do |io| 14 content = io.read 15 content = JsonParser.new.parse(content) 16 dbtype = MyCabinet::HDB 17 dbtype.new.open(dbfile, dbtype::OWRITER | dbtype::OCREAT | dbtype::ONOLCK) do |db| 18 $logger.info "writing entries between #{content[0]['created_at']} and #{content[-1]['created_at']} ..." 19 content.each do |item| 20 db.putasync(item['id'].to_s, item.to_yaml) 13 begin 14 open(source) do |io| 15 content = io.read 16 content = JsonParser.new.parse(content) 17 dbtype = MyCabinet::HDB 18 dbtype.new.open(dbfile, dbtype::OWRITER | dbtype::OCREAT) do |db| 19 $logger.info "writing entries between #{content[0]['created_at']} and #{content[-1]['created_at']} ..." 20 content.each do |item| 21 db.putasync(item['id'].to_s, item.to_yaml) 22 end 21 23 end 22 24 end 25 rescue => e 26 $logger.error "error: #{e.to_s}" 23 27 end -
lang/ruby/echola/hatenastar-rss-download.rb
r18438 r18827 16 16 source = ARGV[0] || 'http://h.hatena.ne.jp/.rss' 17 17 dbfile = ARGV[1] || "#{here}/hatenastar.db" 18 open(source) do |io| 19 content = io.read 20 rss = RSS::Parser.parse(content, false) 21 dbtype = MyCabinet::HDB 22 dbtype.new.open(dbfile, dbtype::OWRITER | dbtype::OCREAT | dbtype::ONOLCK) do |db| 23 $logger.info "writing entries between #{rss.items[0].pubDate.iso8601} and #{rss.items[-1].pubDate.iso8601} ..." 24 rss.items.each do |item| 25 uri = item.link 26 stars = open("http://s.hatena.ne.jp/entries.json?uri=#{URI.encode(uri)}") { |io| io.read } 27 db.putasync(uri, JsonParser.new.parse(stars).to_yaml) 28 sleep sleeplen 18 begin 19 open(source) do |io| 20 content = io.read 21 rss = RSS::Parser.parse(content, false) 22 dbtype = MyCabinet::HDB 23 dbtype.new.open(dbfile, dbtype::OWRITER | dbtype::OCREAT) do |db| 24 $logger.info "writing entries between #{rss.items[0].pubDate.iso8601} and #{rss.items[-1].pubDate.iso8601} ..." 25 rss.items.each do |item| 26 uri = item.link 27 begin 28 stars = open("http://s.hatena.ne.jp/entries.json?uri=#{URI.encode(uri)}") { |io| io.read } 29 db.putasync(uri, JsonParser.new.parse(stars).to_yaml) 30 rescue => e 31 $logger.error "error: #{e.to_s}" 32 ensure 33 sleep sleeplen 34 end 35 end 29 36 end 30 37 end 38 rescue => e 39 $logger.error "error: #{e.to_s}" 31 40 end
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)