consadole_aggregator 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1b691bbd463baaaa94e4cf818735b308ce36657
4
- data.tar.gz: 46dddd75673931323bb0fb5f2516e3abd0aa4d14
3
+ metadata.gz: 16dfc488f24410eb9b3146a95f6a9c97a0c1b9ff
4
+ data.tar.gz: 665cce6b0e3ed34cd755b1727e758c6292ce3f80
5
5
  SHA512:
6
- metadata.gz: b661c47e746df4585c1d968461c712737c74220cd6181066eb9fa83be591c95eef4192ad934c0ba43158bc123a2f77f8de01120718dcd192137eabd79e2c125c
7
- data.tar.gz: ce6aaeaf28a40558ba6c8e2326e8c89f55066875df59c6d31d8c87724765c72acf71a23521b8477c92db136b587287881d66c67a29cc852c7ec6f866bb79169d
6
+ metadata.gz: 439bf36946d44db6375e8f9096b0dab166686d8809912baf528678f3c604e2d8669bfafca3f064083c8b6d53cf9456c48a393b18442915453f67574c51d2f143
7
+ data.tar.gz: d44869e3b5cfb8ffdb5673bed105790d809eea02669a042ee4493c9e2c5bf268f4900381ff18140c126f504a53049e4ea41415d1eb0daaab54fbe65f8c4a0878
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- consadole_aggregator (0.2.8)
4
+ consadole_aggregator (0.2.9)
5
5
  eventmachine
6
6
  httpclient
7
7
  nokogiri
@@ -102,86 +102,100 @@ module ConsadoleAggregator
102
102
 
103
103
  register! do |sites|
104
104
  sites.name(:nikkansports) do |site|
105
- site.resource { HTTPClient.new.get_content('http://www.nikkansports.com/rss/soccer/jleague/consadole.rdf').force_encoding('UTF-8') }
105
+ site.resource { HTTPClient.get_content('http://www.nikkansports.com/rss/soccer/jleague/consadole.rdf').force_encoding('UTF-8') }
106
106
  site.parse_list { |list| RSS::Parser.parse(list, false).items.reverse }
107
107
  site.parse_article { |article| { url: article.link, title: article.title } }
108
108
  end
109
109
 
110
110
  sites.name(:hochiyomiuri) do |site|
111
- site.resource { HTTPClient.new.get_content('http://hochi.yomiuri.co.jp/soccer/jleague/index.htm').force_encoding('UTF-8') }
111
+ site.resource { HTTPClient.get_content('http://hochi.yomiuri.co.jp/soccer/jleague/index.htm').force_encoding('UTF-8') }
112
112
  site.parse_list { |list| Nokogiri::HTML(list).search('div.list1 > ul > li a').reverse }
113
113
  site.filter_article { |article| article.text =~ /^【札幌】/ }
114
114
  site.parse_article { |article| { url:"http://hochi.yomiuri.co.jp#{article['href']}", title:article.text } }
115
115
  end
116
116
 
117
117
  sites.name(:asahi) do |site|
118
- site.resource { HTTPClient.new.get_content('http://www.asahi.com/sports/list/soccer/national_news.html').force_encoding('EUC-JP').encode('UTF-8') }
118
+ site.resource { HTTPClient.get_content('http://www.asahi.com/sports/list/soccer/national_news.html').force_encoding('EUC-JP').encode('UTF-8') }
119
119
  site.parse_list { |list| Nokogiri::HTML(list).search('#HeadLine2 dl dt a').reverse }
120
120
  site.filter_article { |article| article.text =~ /札幌|コンサ/ }
121
121
  site.parse_article { |article| { url: "http://www.asahi.com#{article['href']}", title: article.text } }
122
122
  end
123
123
 
124
124
  sites.name(:mainichi) do |site|
125
- site.resource { HTTPClient.new.get_content('http://mainichi.jp/area/hokkaido/archive/').force_encoding('UTF-8') }
125
+ site.resource { HTTPClient.get_content('http://mainichi.jp/area/hokkaido/archive/').force_encoding('UTF-8') }
126
126
  site.parse_list { |list| Nokogiri::HTML(list).search('#Archive dl dd a').reverse }
127
127
  site.filter_article { |article| article.text =~ /コンサドーレ/ rescue nil }
128
128
  site.parse_article { |article| { url: article['href'], title: article.text.strip } }
129
129
  end
130
130
 
131
131
  sites.name(:forzaconsadole) do |site|
132
- site.resource { HTTPClient.new.get_content('http://www.hokkaido-np.co.jp/news/e_index/?g=consadole').encode('UTF-8') }
132
+ site.resource { HTTPClient.get_content('http://www.hokkaido-np.co.jp/news/e_index/?g=consadole').encode('UTF-8') }
133
133
  site.parse_list { |list| Nokogiri::HTML(list).search('ul.iSwBox > li > a').reverse }
134
134
  site.parse_article { |article| { url: article['href'], title: article.text } }
135
135
  end
136
136
 
137
137
  sites.name(:consaburn) do |site|
138
- site.resource { HTTPClient.new.get_content('http://www.hokkaido-np.co.jp/cont/consa-burn/index.html').encode('UTF-8') }
138
+ site.resource { HTTPClient.get_content('http://www.hokkaido-np.co.jp/cont/consa-burn/index.html').encode('UTF-8') }
139
139
  site.parse_list { |list| Nokogiri::HTML(list).search('ul#news_list > li > a').reverse }
140
140
  site.parse_article { |article| { url: article['href'], title: article.text } }
141
141
  end
142
142
 
143
143
  sites.name(:consaclub) do |site|
144
- site.resource { HTTPClient.new.get_content('http://www.hokkaido-np.co.jp/cont/consa-club/index.html').encode('UTF-8') }
144
+ site.resource { HTTPClient.get_content('http://www.hokkaido-np.co.jp/cont/consa-club/index.html').encode('UTF-8') }
145
145
  site.parse_list { |list| Nokogiri::HTML(list).search('ul#news_list > li > a').reverse }
146
146
  site.parse_article { |article| { url: article['href'], title: article.text } }
147
147
  end
148
148
 
149
149
  sites.name(:consadolenews) do |site|
150
- site.resource { HTTPClient.new.get_content('http://www.consadole-sapporo.jp/news/atom.xml').force_encoding('UTF-8') }
150
+ site.resource { HTTPClient.get_content('http://www.consadole-sapporo.jp/news/atom.xml').force_encoding('UTF-8') }
151
151
  site.parse_list { |list| Nokogiri::XML(list).search('entry').reverse }
152
152
  site.parse_article { |article| { title: article.at('title').text, url: article.at('link')['href'] } }
153
153
  end
154
154
 
155
155
  sites.name(:consadolephotos) do |site|
156
- site.resource { HTTPClient.new.get_content('http://www.consadole-sapporo.jp/').force_encoding('UTF-8') }
156
+ site.resource { HTTPClient.get_content('http://www.consadole-sapporo.jp/').force_encoding('UTF-8') }
157
157
  site.parse_list { |list| Nokogiri::HTML(list).search('div.anythingSlider img').reverse }
158
158
  site.parse_article { |article| { url: article['src'], title: article['alt'] } }
159
159
  end
160
160
 
161
161
  sites.name(:jsgoalnews) do |site|
162
- site.resource { HTTPClient.new.get_content('http://feeds.feedburner.com/jsgoal/jsgoal?format=xml').encode('UTF-8') }
163
- site.parse_list { |list| RSS::Parser.parse(list, false).items.reverse }
162
+ site.resource { HTTPClient.get_content('http://feeds.feedburner.com/jsgoal/jsgoal?format=xml').encode('UTF-8') }
163
+ site.parse_list { |list|
164
+ begin
165
+ RSS::Parser.parse(list, false).items.reverse # FIXME sometimes fail
166
+ rescue
167
+ logger.error('%s: %s'%[site.name, $!])
168
+ []
169
+ end
170
+ }
164
171
  site.filter_article { |article| article.title =~ /札幌/ }
165
172
  site.parse_article { |article|
166
- c = HTTPClient.new.get(article.link)
167
- c = HTTPClient.new.get(c.header['location'].first) while c.status == 301
173
+ entry_point = HTTPClient.get(article.link).header['location'].first
174
+ c = HTTPClient.get(entry_point) while c.status == 301
168
175
  { url: c.header['location'].first, title: article.title }
169
176
  }
170
177
  end
171
178
 
172
179
  sites.name(:jsgoalphotos) do |site|
173
- site.resource { HTTPClient.new.get_content('http://feeds.feedburner.com/jsgoal/photo?format=xml').encode('UTF-8') }
174
- site.parse_list { |list| RSS::Parser.parse(list, false).items.reverse }
180
+ site.resource { HTTPClient.get_content('http://feeds.feedburner.com/jsgoal/photo?format=xml').encode('UTF-8') }
181
+ site.parse_list { |list|
182
+ begin
183
+ RSS::Parser.parse(list, false).items.reverse # FIXME sometimes fail
184
+ rescue
185
+ logger.error('%s: %s'%[site.name, $!])
186
+ []
187
+ end
188
+ }
175
189
  site.filter_article { |article| article.title =~ /札幌/ }
176
190
  site.parse_article { |article|
177
- c = HTTPClient.new.get(article.link)
178
- c = HTTPClient.new.get(c.header['location'].first) while c.status == 301
191
+ entry_point = HTTPClient.get(article.link).header['location'].first
192
+ c = HTTPClient.get(entry_point) while c.status == 301
179
193
  { url: c.header['location'].first, title: article.title }
180
194
  }
181
195
  end
182
196
 
183
197
  sites.name(:clubconsadole) do |site|
184
- site.resource { HTTPClient.new.get_content('http://club-consadole.jp/news/index.php?page=1').encode('UTF-8') }
198
+ site.resource { HTTPClient.get_content('http://club-consadole.jp/news/index.php?page=1').encode('UTF-8') }
185
199
  site.parse_list { |list| Nokogiri::HTML(list).search('li.news a').reverse }
186
200
  site.parse_article { |article| { url: article['href'], title: article.text.strip } }
187
201
  end
@@ -1,3 +1,3 @@
1
1
  module ConsadoleAggregator
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consadole_aggregator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - niku
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-22 00:00:00.000000000 Z
11
+ date: 2013-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -333,141 +333,4 @@ rubygems_version: 2.0.0
333
333
  signing_key:
334
334
  specification_version: 4
335
335
  summary: aggregates infomation of 'Consadole Sapporo'
336
- test_files:
337
- - spec/consadole_aggregator/helper_spec.rb
338
- - spec/consadole_aggregator/live_spec.rb
339
- - spec/consadole_aggregator/news_spec.rb
340
- - spec/consadole_aggregator_spec.rb
341
- - spec/ext/asahi.txt
342
- - spec/ext/clubconsadole.txt
343
- - spec/ext/consaburn.txt
344
- - spec/ext/consaclub.txt
345
- - spec/ext/consadolenews.txt
346
- - spec/ext/consadolephotos.txt
347
- - spec/ext/forzaconsadole.txt
348
- - spec/ext/hochiyomiuri.txt
349
- - spec/ext/jsgoalnews.txt
350
- - spec/ext/jsgoalphotos.txt
351
- - spec/ext/live/s674.html
352
- - spec/ext/live/s674.html.1
353
- - spec/ext/live/s674.html.10
354
- - spec/ext/live/s674.html.100
355
- - spec/ext/live/s674.html.101
356
- - spec/ext/live/s674.html.102
357
- - spec/ext/live/s674.html.103
358
- - spec/ext/live/s674.html.104
359
- - spec/ext/live/s674.html.105
360
- - spec/ext/live/s674.html.106
361
- - spec/ext/live/s674.html.107
362
- - spec/ext/live/s674.html.108
363
- - spec/ext/live/s674.html.109
364
- - spec/ext/live/s674.html.11
365
- - spec/ext/live/s674.html.110
366
- - spec/ext/live/s674.html.111
367
- - spec/ext/live/s674.html.112
368
- - spec/ext/live/s674.html.113
369
- - spec/ext/live/s674.html.114
370
- - spec/ext/live/s674.html.115
371
- - spec/ext/live/s674.html.116
372
- - spec/ext/live/s674.html.117
373
- - spec/ext/live/s674.html.118
374
- - spec/ext/live/s674.html.119
375
- - spec/ext/live/s674.html.12
376
- - spec/ext/live/s674.html.120
377
- - spec/ext/live/s674.html.13
378
- - spec/ext/live/s674.html.14
379
- - spec/ext/live/s674.html.15
380
- - spec/ext/live/s674.html.16
381
- - spec/ext/live/s674.html.17
382
- - spec/ext/live/s674.html.18
383
- - spec/ext/live/s674.html.19
384
- - spec/ext/live/s674.html.2
385
- - spec/ext/live/s674.html.20
386
- - spec/ext/live/s674.html.21
387
- - spec/ext/live/s674.html.22
388
- - spec/ext/live/s674.html.23
389
- - spec/ext/live/s674.html.24
390
- - spec/ext/live/s674.html.25
391
- - spec/ext/live/s674.html.26
392
- - spec/ext/live/s674.html.27
393
- - spec/ext/live/s674.html.28
394
- - spec/ext/live/s674.html.29
395
- - spec/ext/live/s674.html.3
396
- - spec/ext/live/s674.html.30
397
- - spec/ext/live/s674.html.31
398
- - spec/ext/live/s674.html.32
399
- - spec/ext/live/s674.html.33
400
- - spec/ext/live/s674.html.34
401
- - spec/ext/live/s674.html.35
402
- - spec/ext/live/s674.html.36
403
- - spec/ext/live/s674.html.37
404
- - spec/ext/live/s674.html.38
405
- - spec/ext/live/s674.html.39
406
- - spec/ext/live/s674.html.4
407
- - spec/ext/live/s674.html.40
408
- - spec/ext/live/s674.html.41
409
- - spec/ext/live/s674.html.42
410
- - spec/ext/live/s674.html.43
411
- - spec/ext/live/s674.html.44
412
- - spec/ext/live/s674.html.45
413
- - spec/ext/live/s674.html.46
414
- - spec/ext/live/s674.html.47
415
- - spec/ext/live/s674.html.48
416
- - spec/ext/live/s674.html.49
417
- - spec/ext/live/s674.html.5
418
- - spec/ext/live/s674.html.50
419
- - spec/ext/live/s674.html.51
420
- - spec/ext/live/s674.html.52
421
- - spec/ext/live/s674.html.53
422
- - spec/ext/live/s674.html.54
423
- - spec/ext/live/s674.html.55
424
- - spec/ext/live/s674.html.56
425
- - spec/ext/live/s674.html.57
426
- - spec/ext/live/s674.html.58
427
- - spec/ext/live/s674.html.59
428
- - spec/ext/live/s674.html.6
429
- - spec/ext/live/s674.html.60
430
- - spec/ext/live/s674.html.61
431
- - spec/ext/live/s674.html.62
432
- - spec/ext/live/s674.html.63
433
- - spec/ext/live/s674.html.64
434
- - spec/ext/live/s674.html.65
435
- - spec/ext/live/s674.html.66
436
- - spec/ext/live/s674.html.67
437
- - spec/ext/live/s674.html.68
438
- - spec/ext/live/s674.html.69
439
- - spec/ext/live/s674.html.7
440
- - spec/ext/live/s674.html.70
441
- - spec/ext/live/s674.html.71
442
- - spec/ext/live/s674.html.72
443
- - spec/ext/live/s674.html.73
444
- - spec/ext/live/s674.html.74
445
- - spec/ext/live/s674.html.75
446
- - spec/ext/live/s674.html.76
447
- - spec/ext/live/s674.html.77
448
- - spec/ext/live/s674.html.78
449
- - spec/ext/live/s674.html.79
450
- - spec/ext/live/s674.html.8
451
- - spec/ext/live/s674.html.80
452
- - spec/ext/live/s674.html.81
453
- - spec/ext/live/s674.html.82
454
- - spec/ext/live/s674.html.83
455
- - spec/ext/live/s674.html.84
456
- - spec/ext/live/s674.html.85
457
- - spec/ext/live/s674.html.86
458
- - spec/ext/live/s674.html.87
459
- - spec/ext/live/s674.html.88
460
- - spec/ext/live/s674.html.89
461
- - spec/ext/live/s674.html.9
462
- - spec/ext/live/s674.html.90
463
- - spec/ext/live/s674.html.91
464
- - spec/ext/live/s674.html.92
465
- - spec/ext/live/s674.html.93
466
- - spec/ext/live/s674.html.94
467
- - spec/ext/live/s674.html.95
468
- - spec/ext/live/s674.html.96
469
- - spec/ext/live/s674.html.97
470
- - spec/ext/live/s674.html.98
471
- - spec/ext/live/s674.html.99
472
- - spec/ext/nikkansports.txt
473
- - spec/spec_helper.rb
336
+ test_files: []