nicoscraper 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -325,7 +325,7 @@ GitHubを経由して下さってもいいのですが、まだ慣れていな
325
325
 
326
326
  ###更新履歴
327
327
 
328
- **v 0.2.8**
328
+ **v 0.2.8 - 0.2.9**
329
329
 
330
330
  + MylistAtomパーサが再生数等を認識しない問題を修正。
331
331
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
1
+ 0.2.9
@@ -43,9 +43,7 @@ module Nicos
43
43
  parsed[label] = Nicos::Converter.iso8601ToUnix(doc.value)
44
44
  when "length"
45
45
  doc.read
46
- lengthStr = doc.value.split(/\:/)
47
- length = lengthStr[0].to_i * 60 + lengthStr[1].to_i
48
- parsed["length"] = length
46
+ parsed["length"] = Nicos::Converter.toSeconds(doc.value)
49
47
  when "tags"
50
48
  doc.move_to_attribute("domain")
51
49
  category = doc.value
@@ -84,42 +82,40 @@ module Nicos
84
82
  parsed[n] = {}
85
83
  when "title"
86
84
  doc.read
87
- parsed[n]["title"] = doc.value
85
+ parsed[n]["title"] = doc.value
88
86
  when "link"
89
87
  doc.move_to_attribute("href")
90
- parsed[n]["video_id"] = doc.value.split('/')[4]
88
+ parsed[n]["video_id"] = doc.value.split('/')[4]
91
89
  when "published", "updated"
92
90
  label = doc.name
93
91
  doc.read
94
- parsed[n][label] = Nicos::Converter.iso8601ToUnix(doc.value)
92
+ parsed[n][label] = Nicos::Converter.iso8601ToUnix(doc.value)
95
93
  when "p"
96
94
  doc.move_to_attribute("class")
97
95
  case doc.value
98
96
  when "nico-thumbnail"
99
97
  doc.read
100
98
  doc.move_to_attribute("src")
101
- parsed[n]["thumbnail_url"] = doc.value
99
+ parsed[n]["thumbnail_url"] = doc.value
102
100
  when "nico-description"
103
101
  doc.read
104
- parsed[n]["description"] = doc.value
102
+ parsed[n]["description"] = doc.value
105
103
  end
106
104
  when "strong"
107
105
  doc.move_to_attribute("class")
108
106
  case doc.value
109
107
  when "nico-info-length"
110
108
  doc.read
111
- lengthStr = doc.value.split(/\:/)
112
- length = lengthStr[0].to_i * 60 + lengthStr[1].to_i
113
- parsed[n]["length"] = length
109
+ parsed[n]["length"] = Nicos::Converter.toSeconds(doc.value)
114
110
  when "nico-info-date"
115
111
  label = doc.name
116
112
  doc.read
117
- parsed[n]["first_retrieve"] = Nicos::Converter.japToUnix(doc.value)
118
- when "nico-numbers-view", "nico-numbers-res",
113
+ parsed[n]["first_retrieve"] = Nicos::Converter.japToUnix(doc.value)
114
+ when "nico-numbers-view", "nico-numbers-res",
119
115
  "nico-numbers-mylist"
120
116
  label = doc.value
121
117
  doc.read
122
- parsed[n][label.slice(13,99)] = doc.value.to_i
118
+ parsed[n][label.slice(13,99)] = Nicos::Converter::commaRemover(doc.value)
123
119
  end
124
120
  end
125
121
  end
@@ -201,20 +197,20 @@ module Nicos
201
197
  /(<p\sclass\=\"nico-description\"\>)([^\<]{1,})/ =~ html
202
198
  description = $2
203
199
 
204
- /(<p\sclass\=\"nico-info-length\"\>)([^\<]{1,})/ =~ html
205
- length = $2
200
+ /(<strong\sclass\=\"nico-info-length\"\>)([^\<]{1,})/ =~ html
201
+ length = Nicos::Converter.toSeconds($2)
206
202
 
207
203
  /(<strong\sclass\=\"nico-info-date\"\>)([^\<]{1,})/ =~ html
208
204
  first_retrieve = Nicos::Converter.japToUnix($2)
209
205
 
210
206
  /(<strong\sclass\=\"nico-numbers-view\"\>)([^\<]{1,})/ =~ html
211
- view = $2
207
+ view = Nicos::Converter.commaRemover($2)
212
208
 
213
209
  /(<strong\sclass\=\"nico-numbers-res\"\>)([^\<]{1,})/ =~ html
214
- res = $2
210
+ res = Nicos::Converter.commaRemover($2)
215
211
 
216
212
  /(<strong\sclass\=\"nico-numbers-mylist\"\>)([^\<]{1,})/ =~ html
217
- mylist = $2
213
+ mylist = Nicos::Converter.commaRemover($2)
218
214
 
219
215
  parsed["entry"][n]["memo"] = memo
220
216
  parsed["entry"][n]["thumbnail_url"] = thumbnail_url
data/nicoscraper.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{nicoscraper}
8
- s.version = "0.2.8"
8
+ s.version = "0.2.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Masami Yonehara}]
data/test/movie_spec.rb CHANGED
@@ -7,6 +7,7 @@ describe Nicos::Movie, "After executiton of 'getInfo' method" do
7
7
  before(:all) do
8
8
  @movie = Nicos::Movie.new("sm1097445")
9
9
  @movie.getInfo
10
+ p @movie
10
11
  end
11
12
 
12
13
  it "should have following values" do
data/test/mylist_spec.rb CHANGED
@@ -27,9 +27,9 @@ describe Nicos::Movie, "After executiton of 'getInfo' method" do
27
27
  movieObj.thumbnail_url.should_not be_nil
28
28
  movieObj.length .should_not be_nil
29
29
 
30
- movieObj.view_counter .should_not be_nil
31
- movieObj.comment_num .should_not be_nil
32
- movieObj.mylist_counter.should_not be_nil
30
+ movieObj.view_counter .should_not == 0
31
+ movieObj.comment_num .should_not == 0
32
+ movieObj.mylist_counter.should_not == 0
33
33
  end
34
34
 
35
35
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: nicoscraper
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.8
5
+ version: 0.2.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - Masami Yonehara
@@ -145,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
146
  - - ">="
147
147
  - !ruby/object:Gem::Version
148
- hash: -2925432120660025319
148
+ hash: 3267649262953324445
149
149
  segments:
150
150
  - 0
151
151
  version: "0"