harunica 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d932bdfc49d9fb6140d19355f16794a570600f5e
4
- data.tar.gz: 936a76ce65e359d8d55d53a030b5c3bc0981943a
3
+ metadata.gz: 28fa99d3a16ff6c0fa57cc7226e7e76a72c047ba
4
+ data.tar.gz: 132d8844f6f63ee9bab202ff4b454e7d3257b194
5
5
  SHA512:
6
- metadata.gz: 2474aea0a8d0e19ba4e95bae685e8b2659658ae743b44d06dbfc55fd456622ab5ee82c85201e7feec1eca07049478447506188d9bf41dc391683402ec6ac8720
7
- data.tar.gz: 55120c926c410fc369a2982bfaed020cdd9d87b2a85aefe9c017767a9436d2cdb97d9ba23213b24de3689d7b6f7c39bb86dbb4a5b3be745f871ac8375d9bf1a6
6
+ metadata.gz: 5e64ac9c09c1b52548cbf53bd9ffc9addf35858ff74bc98e5cc4051df57e2663ee1962db1efce6c9d42feb4962da4d4808d42ffef4b320a671d520230fd1fac7
7
+ data.tar.gz: d76c1723b7a1f13b04e07fe2bfbb1f72962e319f733053a6f28f69b6db6a86598c85bd2edaaa541fad08f9f97da88ec96d668852d54eda7faa55312b3b51a226
@@ -31,8 +31,8 @@ module Harunica
31
31
  def video_pages
32
32
  @video_pages ||= html.doc.css(VIDEO_SELECTORS.join(' ')).map do |e|
33
33
  url = html.url.base + e.css('.itemContent .itemTitle a')[0].attr('href')
34
- thumb_url = e.css('.videoList01Wrap .uadWrap .itemThumbBox .thumb')[0].attr('src')
35
- VideoPage.new(Html.new(url), thumb_url)
34
+ id = e.css('.videoList01Wrap .uadWrap .itemThumbBox .itemThumb')[0].attr('data-id')
35
+ VideoPage.new(Html.new(url), id)
36
36
  end
37
37
  end
38
38
 
@@ -19,11 +19,11 @@ module Harunica
19
19
  'p:last-child'
20
20
  ]
21
21
 
22
- attr_reader :html, :thumbnail_url
22
+ attr_reader :html, :id
23
23
 
24
- def initialize(html, thumbnail_url)
24
+ def initialize(html, id)
25
25
  @html = html
26
- @thumbnail_url = thumbnail_url
26
+ @id = id
27
27
  end
28
28
 
29
29
  def author
@@ -41,6 +41,15 @@ module Harunica
41
41
  def url
42
42
  html.url
43
43
  end
44
+
45
+ def thumbnail_url
46
+ @thumbnail_url ||= self.class.id_to_thumbnail_url(id)
47
+ end
48
+
49
+ def self.id_to_thumbnail_url(id)
50
+ /^sm(\d+)$/ =~ id
51
+ Harunica::Scraping::THUMBNAIL_SERVER_URL + "/smile?i=#{$1}.M"
52
+ end
44
53
  end
45
54
  end
46
55
  end
@@ -4,5 +4,7 @@ module Harunica
4
4
  autoload :ListPage, __dir__ + '/scraping/list_page'
5
5
  autoload :Url, __dir__ + '/scraping/url'
6
6
  autoload :VideoPage, __dir__ + '/scraping/video_page'
7
+
8
+ THUMBNAIL_SERVER_URL = 'http://tn-skr1.smilevideo.jp'
7
9
  end
8
10
  end
@@ -1,3 +1,3 @@
1
1
  module Harunica
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harunica
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - mosop
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.4.8
128
+ rubygems_version: 2.4.5
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Collect and Analyze '春ニカ祭' posts from nicovideo.jp