Sha256: d5451090a7235512bda514c625ff4bd6215428b29c0b9e68e687dbcddb36d10e
Contents?: true
Size: 756 Bytes
Versions: 5
Compression:
Stored size: 756 Bytes
Contents
# -*- coding: utf-8 -*- require 'net/http' require 'kconv' module ConsadoleAggregator module Live module Parser BASE_URI = URI.parse('http://www.consadole-sapporo.jp/view/s674.html') TimeLine = Struct.new :time, :post do def initialize line tmp = line.split self['time'] = tmp[0] self['post'] = tmp[1] end end def Parser.parse response = Net::HTTP.get(BASE_URI).force_encoding("Shift_JIS") doc = Nokogiri::HTML.parse(response.toutf8, nil, 'UTF-8') doc.search('hr + p').last.inner_html.gsub(/<br>/,'').split("\n").map{ |line| TimeLine.new line unless /<εε>|<εΎε>/ =~ line }.compact.reverse end end end end
Version data entries
5 entries across 5 versions & 1 rubygems