consadole_aggregator 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/consadole_aggregator.gemspec +11 -13
- data/lib/consadole_aggregator.rb +6 -1
- data/lib/consadole_aggregator/nikkan_sports.rb +37 -21
- data/spec/nikkan_sports/consadole.rdf +478 -0
- data/spec/nikkan_sports/nikkan_sports_spec.rb +55 -0
- data/spec/nikkan_sports/p-sc-tp0-20091225-579346.html +1547 -0
- metadata +8 -10
- data/lib/consadole_aggregator/nikkan_sports/builder.rb +0 -29
- data/lib/consadole_aggregator/nikkan_sports/entry.rb +0 -19
- data/lib/consadole_aggregator/nikkan_sports/parser.rb +0 -37
- data/lib/consadole_aggregator/result +0 -2
- data/spec/consadole_aggregator/nikkan_sports_spec.rb +0 -8
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consadole_aggregator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- niku
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-30 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: hpricot
|
17
17
|
type: :development
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -50,12 +50,10 @@ files:
|
|
50
50
|
- lib/consadole_aggregator/live/builder.rb
|
51
51
|
- lib/consadole_aggregator/live/parser.rb
|
52
52
|
- lib/consadole_aggregator/nikkan_sports.rb
|
53
|
-
- lib/consadole_aggregator/nikkan_sports/builder.rb
|
54
|
-
- lib/consadole_aggregator/nikkan_sports/entry.rb
|
55
|
-
- lib/consadole_aggregator/nikkan_sports/parser.rb
|
56
|
-
- lib/consadole_aggregator/result
|
57
|
-
- spec/consadole_aggregator/nikkan_sports_spec.rb
|
58
53
|
- spec/consadole_aggregator_spec.rb
|
54
|
+
- spec/nikkan_sports/consadole.rdf
|
55
|
+
- spec/nikkan_sports/nikkan_sports_spec.rb
|
56
|
+
- spec/nikkan_sports/p-sc-tp0-20091225-579346.html
|
59
57
|
- spec/spec.opts
|
60
58
|
- spec/spec_helper.rb
|
61
59
|
- spec/timeline/s674.html
|
@@ -190,7 +188,7 @@ require_paths:
|
|
190
188
|
- lib
|
191
189
|
required_ruby_version: !ruby/object:Gem::Requirement
|
192
190
|
requirements:
|
193
|
-
- -
|
191
|
+
- - ">="
|
194
192
|
- !ruby/object:Gem::Version
|
195
193
|
version: 1.8.7
|
196
194
|
version:
|
@@ -208,6 +206,6 @@ signing_key:
|
|
208
206
|
specification_version: 3
|
209
207
|
summary: Consadole Sapporo's Information Aggregator
|
210
208
|
test_files:
|
211
|
-
- spec/consadole_aggregator/nikkan_sports_spec.rb
|
212
209
|
- spec/consadole_aggregator_spec.rb
|
210
|
+
- spec/nikkan_sports/nikkan_sports_spec.rb
|
213
211
|
- spec/spec_helper.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'rss'
|
3
|
-
|
4
|
-
module ConsadoleAggregator
|
5
|
-
module NikkanSports
|
6
|
-
module Builder
|
7
|
-
module Rss
|
8
|
-
def Rss.build entries
|
9
|
-
RSS::Maker.make('atom') do |maker|
|
10
|
-
maker.channel.about = 'http://sirase.ru/consadole/nikkansports_consadole.rdf'
|
11
|
-
maker.channel.title = 'コンサドーレ札幌:nikkansports.com(非公式RSS版)'
|
12
|
-
maker.channel.description = 'コンサドーレ札幌:nikkansports.comのニュース一覧(非公式RSS版)'
|
13
|
-
maker.channel.link = 'http://www.nikkansports.com/soccer/jleague/team/co-team.html'
|
14
|
-
maker.channel.author = 'ConsadoleAggregator'
|
15
|
-
maker.channel.date = Time.now
|
16
|
-
|
17
|
-
maker.items.do_sort = true
|
18
|
-
|
19
|
-
entries.each do |entry|
|
20
|
-
maker.items.new_item do |item|
|
21
|
-
yield item, entry
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'dm-core'
|
3
|
-
require 'dm-types'
|
4
|
-
require 'dm-validations'
|
5
|
-
|
6
|
-
module ConsadoleAggregator
|
7
|
-
module NikkanSports
|
8
|
-
class Entry
|
9
|
-
include DataMapper::Resource
|
10
|
-
|
11
|
-
property :id, Serial
|
12
|
-
property :uri, URI, :unique => true
|
13
|
-
property :title, String
|
14
|
-
property :text, Text
|
15
|
-
property :post_date, Time
|
16
|
-
property :image, String
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
module ConsadoleAggregator
|
3
|
-
module NikkanSports
|
4
|
-
module Parser
|
5
|
-
module List
|
6
|
-
BASE_URI = URI.parse('http://www.nikkansports.com/soccer/jleague/team/co-team.html')
|
7
|
-
|
8
|
-
Element = Struct.new :uri, :title, :post_date, :has_image? do
|
9
|
-
def initialize element
|
10
|
-
self['uri'] = URI.parse(element.at('a')['href'])
|
11
|
-
self['title'] = element.at('a').text
|
12
|
-
self['post_date'] = Time.strptime(element.at('span').text.match(/\d+日\d+:\d+/).to_s, '%d日%H:%M')
|
13
|
-
self['has_image?'] = !element.at('img').nil?
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def List.parse doc
|
18
|
-
doc.search('div#topNewsInner ul.newsList01 li').map{|element| Element.new element}
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module Entry
|
23
|
-
IMAGE_BASE_URI = URI.parse('http://cache2.nipc.jp/soccer/news/')
|
24
|
-
|
25
|
-
def Entry.parse doc, uri = nil
|
26
|
-
entry = NikkanSports::Entry.new
|
27
|
-
entry.uri = uri if uri
|
28
|
-
entry.title = doc.at('h1').text
|
29
|
-
entry.text = doc.search('p')[0...-1].to_s
|
30
|
-
entry.post_date = Time.strptime(doc.search('p').last.text.match(/\d+年\d+月\d+日\d+時\d+分/).to_s, '%Y年%m月%d日%H時%M分')
|
31
|
-
entry.image = Image.new(IMAGE_BASE_URI + image['src'].sub(/\.jpg$/, '-big.jpg'), image['alt']) unless doc.at('img').nil?
|
32
|
-
return entry
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,2 +0,0 @@
|
|
1
|
-
["/opt/local/lib/ruby/site_ruby/1.8", "/opt/local/lib/ruby/site_ruby/1.8/i686-darwin10", "/opt/local/lib/ruby/site_ruby", "/opt/local/lib/ruby/vendor_ruby/1.8", "/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin10", "/opt/local/lib/ruby/vendor_ruby", "/opt/local/lib/ruby/1.8", "/opt/local/lib/ruby/1.8/i686-darwin10", ".", ".."]
|
2
|
-
#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091128-570363.html", title="\346\234\255\345\271\214\346\233\275\347\224\260\343\201\214\345\210\207\343\202\212\346\234\255\343\200\201\346\250\252\346\265\234\357\274\246\357\274\243\346\210\246\357\274\222\344\270\207\344\272\272\345\221\274\343\201\266\357\274\201", post_date=#<Date: 4910327/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091127-569984.html", title="\346\234\255\345\271\214\346\233\275\347\224\260\343\200\201\357\274\246\357\274\267\343\201\247\347\217\276\345\275\271\346\234\200\345\276\214\343\201\256\343\203\224\343\203\203\343\203\201\343\201\253", post_date=#<Date: 4910325/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091126-569688.html", title="\346\234\255\345\271\214\347\237\263\345\264\216\347\233\243\347\235\243\343\200\201\346\235\245\345\255\243\343\202\202\357\274\221\345\271\264\345\245\221\347\264\204\343\201\247\351\200\200\350\267\257\347\265\266\343\201\244", post_date=#<Date: 4910323/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/f-sc-tp0-20091125-569479.html", title="\357\274\252\357\274\222\346\234\255\345\271\214\343\201\214\347\237\263\345\264\216\347\233\243\347\235\243\343\201\256\347\266\232\346\212\225\343\202\222\347\231\272\350\241\250", post_date=#<Date: 4910321/2,0,2299161>, :has_image?=true>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091123-568835.html", title="\357\274\223\345\271\264\347\233\256\343\201\256\346\234\255\345\271\214\345\262\251\346\262\274\343\201\214\343\203\227\343\203\255\345\210\235\343\202\264\343\203\274\343\203\253\357\274\217\357\274\252\357\274\222", post_date=#<Date: 4910317/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091123-568833.html", title="\346\234\255\345\271\214\347\237\263\345\264\216\347\233\243\347\235\243\343\201\256\351\200\232\347\256\227500\346\210\246\347\233\256\343\201\253\345\213\235\345\210\251\357\274\217\357\274\252\357\274\222", post_date=#<Date: 4910317/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/f-sc-tp0-20091122-568658.html", title="\347\245\235\347\240\262\357\274\224\347\231\272!!\346\234\255\345\271\214\347\237\263\345\264\216\347\233\243\347\235\243500\350\251\246\345\220\210\357\274\217\357\274\252\357\274\222", post_date=#<Date: 4910315/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091122-568510.html", title="\346\234\255\345\271\214\347\237\263\345\264\216\347\233\243\347\235\243\343\201\214\343\202\267\343\202\271\343\203\206\343\203\240\344\277\256\346\255\243\343\201\253\347\235\200\346\211\213", post_date=#<Date: 4910315/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091122-568513.html", title="\346\234\255\345\271\214\357\274\247\357\274\253\351\253\230\345\216\237\343\203\227\343\203\255\345\205\245\343\202\212\345\276\214\345\210\235\343\201\256\345\234\260\345\205\203\346\210\246\343\201\253\351\227\230\345\277\227", post_date=#<Date: 4910315/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091121-568120.html", title="\346\234\255\345\271\214\347\237\263\345\264\216\347\233\243\347\235\243\343\200\201\345\267\246\357\274\263\357\274\242\345\200\231\350\243\234\343\201\256\345\262\251\346\262\274\343\201\253\347\206\261\350\246\226\347\267\232", post_date=#<Date: 4910313/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091121-568119.html", title="\346\234\255\345\271\214\347\237\263\345\264\216\347\233\243\347\235\243\343\201\214\350\213\245\346\211\213\343\201\253\343\203\217\343\203\274\343\203\211\343\201\252\345\200\213\344\272\272\347\267\264\347\277\222", post_date=#<Date: 4910313/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091120-567791.html", title="\346\234\255\345\271\214\343\200\201\346\235\245\345\255\243\345\274\267\345\214\226\350\262\273\343\201\257\357\274\223\345\204\204\345\206\206\345\217\260\343\201\253\346\270\233\351\241\215\343\201\270", post_date=#<Date: 4910311/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091120-567789.html", title="\357\274\26519\345\207\261\346\227\213\343\201\256\346\234\255\345\271\214\345\217\244\347\224\260\343\200\201\346\201\251\345\270\253\343\201\253\345\213\235\345\210\251\350\264\210\343\202\213!!", post_date=#<Date: 4910311/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091119-567419.html", title="\346\234\255\345\271\214\345\256\256\346\262\242\343\201\214\357\274\265\357\274\21520\343\201\247\345\210\235\343\201\256\357\274\255\357\274\246\347\231\273\351\214\262", post_date=#<Date: 4910309/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091119-567417.html", title="\346\234\255\345\271\214\347\237\263\345\264\216\347\233\243\347\235\243\347\266\232\346\212\225\343\200\201\346\255\243\345\274\217\343\202\252\343\203\225\343\202\241\343\203\274\343\202\222\345\217\227\350\253\276", post_date=#<Date: 4910309/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091118-567107.html", title="\346\234\255\345\271\214\344\270\200\347\255\213\343\201\256\346\233\275\347\224\260\345\274\225\351\200\200\343\200\20129\346\227\245\345\274\225\351\200\200\343\202\273\343\203\254\343\203\242\343\203\213\343\203\274", post_date=#<Date: 4910307/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091118-567108.html", title="\346\234\255\345\271\214\343\200\201\346\235\245\345\255\243\345\247\213\345\213\225\343\201\257\357\274\221\346\234\21017\346\227\245", post_date=#<Date: 4910307/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091117-566777.html", title="\346\234\255\345\271\21411\346\234\210\344\270\255\343\203\246\343\203\213\343\203\233\343\203\274\343\203\240\343\202\271\343\203\235\343\203\263\343\202\265\343\203\274\346\261\272\345\256\232\343\201\270", post_date=#<Date: 4910305/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091117-566775.html", title="\346\234\255\345\271\214\343\201\214\343\202\270\343\203\247\343\203\274\343\202\253\343\203\274\346\254\240\344\271\217\347\227\207\345\205\213\346\234\215\343\202\222\347\233\256\346\214\207\343\201\231!!", post_date=#<Date: 4910305/2,0,2299161>, :has_image?=false>#<struct ConsadoleAggregator::NikkanSports::Parser::List::Element uri="http://www.nikkansports.com/soccer/news/p-sc-tp0-20091114-565874.html", title="\347\237\263\345\264\216\347\233\243\347\235\243\343\201\214\357\275\242\346\234\255\345\271\214\351\201\270\346\211\213\347\211\210\346\203\205\345\240\261\343\203\257\343\202\244\343\203\211\343\202\267\343\203\247\343\203\274\357\275\243", post_date=#<Date: 4910299/2,0,2299161>, :has_image?=false>
|