nicoscraper 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,94 @@ require 'converter.rb'
9
9
 
10
10
  module Nicos
11
11
  module Parser
12
+ def parseRow(symbol, type, doc)
13
+ hash = {}
14
+
15
+ value = case type
16
+ when :Fixnum then
17
+ doc.read
18
+ doc.value.to_i
19
+ when :String then
20
+ doc.read
21
+ p doc.value
22
+ doc.value
23
+ when :ISO8601 then
24
+ doc.read
25
+ Nicos::Converter.iso8601ToUnix(doc.value)
26
+ when :JapDate then
27
+ doc.read
28
+ Nicos::Converter.japToUnix(doc.value)
29
+ when :Time then
30
+ doc.read
31
+ Nicos::Converter.toSeconds(doc.value)
32
+
33
+ # for Mylist Atom
34
+ when :mylistId then
35
+ doc.read
36
+ Nicos::Extractor.mylistId(doc.value)
37
+ when :videoId then
38
+ doc.move_to_attribute("href")
39
+ Nicos::Extractor.videoId(doc.value)
40
+
41
+ # for getThumbInfo
42
+ when :Tags then
43
+ doc.move_to_attribute("domain")
44
+ symbol = case doc.value
45
+ when "jp" then :tags_jp
46
+ when "tw" then :tags_tw
47
+ when "de" then :tags_de
48
+ when "es" then :tags_es
49
+ end
50
+
51
+ tags = []
52
+ lockedTags = []
53
+ category = nil
54
+ lock = nil
55
+
56
+ while doc.read
57
+ unless doc.node_type == XML::Reader::TYPE_END_ENTITY
58
+ break if doc.name === "tags"
59
+
60
+ if category == nil
61
+ doc.move_to_attribute("category")
62
+ if doc.name === "category"
63
+ doc.read
64
+ category = doc.value
65
+ doc.read
66
+ end
67
+ end
68
+
69
+ doc.move_to_attribute("lock")
70
+ if doc.name === "lock"
71
+ lock = true
72
+ doc.read
73
+ doc.read
74
+ else lock = false
75
+ end
76
+
77
+ doc.read_inner_xml
78
+ if doc.value != nil
79
+ if lock then lockedTags.push(doc.value)
80
+ else tags.push(doc.value) end
81
+ end
82
+ end
83
+ end
84
+
85
+ {
86
+ :category => category,
87
+ :tags => tags,
88
+ :lockedTags => lockedTags
89
+ }
90
+ end
91
+
92
+ hash[symbol] = value
93
+ hash
94
+ end
95
+ module_function :parseRow
96
+
97
+ def parseTag
98
+ end
99
+
12
100
  # getThumbInfoが返すXMLを解析し、ハッシュオブジェクトにして返します。
13
101
  #
14
102
  # @return [HashObj]
@@ -21,39 +109,34 @@ module Nicos
21
109
 
22
110
  n = -1
23
111
  parsed = {}
24
- category = ""
25
112
 
26
113
  while doc.read
27
114
  unless doc.node_type == XML::Reader::TYPE_END_ELEMENT
28
- case doc.name
29
- when "video_id", "title", "description", "thumbnail_url",
30
- "movie_type", "last_res_body" , "watch_url", "thumb_type"
31
- label = doc.name
32
- doc.read
33
- parsed[label] = doc.value
34
- when "size_high", "size_low", "view_counter", "comment_num",
35
- "mylist_counter", "embeddable", "no_live_play",
36
- "user_id"
37
- label = doc.name
38
- doc.read
39
- parsed[label] = doc.value.to_i
40
- when "first_retrieve"
41
- label = doc.name
42
- doc.read
43
- parsed[label] = Nicos::Converter.iso8601ToUnix(doc.value)
44
- when "length"
45
- doc.read
46
- parsed["length"] = Nicos::Converter.toSeconds(doc.value)
47
- when "tags"
48
- doc.move_to_attribute("domain")
49
- category = doc.value
50
- if defined? parsed["tags" + category]
51
- parsed["tags_" + category] = []
52
- end
53
- when "tag"
54
- doc.read
55
- parsed["tags_" + category].push(doc.value)
56
- end
115
+ row = case doc.name
116
+ when "video_id" then parseRow(:video_id, :String, doc)
117
+ when "title" then parseRow(:title, :String, doc)
118
+ when "description" then parseRow(:description, :String, doc)
119
+ when "thumbnail_url" then parseRow(:thumbnail_url, :String, doc)
120
+ when "movie_type" then parseRow(:movie_type, :String, doc)
121
+ when "last_res_body" then parseRow(:last_res_body, :String, doc)
122
+ when "watch_url" then parseRow(:watch_url, :String, doc)
123
+ when "thumb_type" then parseRow(:thumb_type, :String, doc)
124
+
125
+ when "size_high" then parseRow(:size_high, :Fixnum, doc)
126
+ when "size_low" then parseRow(:size_low, :Fixnum, doc)
127
+ when "view_counter" then parseRow(:view_counter, :Fixnum, doc)
128
+ when "comment_num" then parseRow(:comment_num, :Fixnum, doc)
129
+ when "mylist_counter" then parseRow(:mylist_counter,:Fixnum, doc)
130
+ when "embeddable" then parseRow(:embeddable, :Fixnum, doc)
131
+ when "no_live_play" then parseRow(:no_live_play, :Fixnum, doc)
132
+ when "user_id" then parseRow(:user_id, :Fixnum, doc)
133
+ when "first_retrieve" then parseRow(:first_retrieve,:ISO8601, doc)
134
+ when "length" then parseRow(:length, :Time, doc)
135
+ when "tags" then parseRow(:tags, :Tags, doc)
136
+ when "tag" then parseRow(:tag, :Tag, doc)
137
+ end
138
+
139
+ parsed.update(row) if row != nil
57
140
  end
58
141
  end
59
142
 
@@ -82,10 +165,10 @@ module Nicos
82
165
  parsed[n] = {}
83
166
  when "title"
84
167
  doc.read
85
- parsed[n]["title"] = doc.value
168
+ parsed[n][:title] = doc.value
86
169
  when "link"
87
170
  doc.move_to_attribute("href")
88
- parsed[n]["video_id"] = doc.value.split('/')[4]
171
+ parsed[n][:video_id] = doc.value.split('/')[4]
89
172
  when "published", "updated"
90
173
  label = doc.name
91
174
  doc.read
@@ -96,21 +179,21 @@ module Nicos
96
179
  when "nico-thumbnail"
97
180
  doc.read
98
181
  doc.move_to_attribute("src")
99
- parsed[n]["thumbnail_url"] = doc.value
182
+ parsed[n][:thumbnail_url] = doc.value
100
183
  when "nico-description"
101
184
  doc.read
102
- parsed[n]["description"] = doc.value
185
+ parsed[n][:description] = doc.value
103
186
  end
104
187
  when "strong"
105
188
  doc.move_to_attribute("class")
106
189
  case doc.value
107
190
  when "nico-info-length"
108
191
  doc.read
109
- parsed[n]["length"] = Nicos::Converter.toSeconds(doc.value)
192
+ parsed[n][:length] = Nicos::Converter.toSeconds(doc.value)
110
193
  when "nico-info-date"
111
194
  label = doc.name
112
195
  doc.read
113
- parsed[n]["first_retrieve"] = Nicos::Converter.japToUnix(doc.value)
196
+ parsed[n][:first_retrieve] = Nicos::Converter.japToUnix(doc.value)
114
197
  when "nico-numbers-view", "nico-numbers-res",
115
198
  "nico-numbers-mylist"
116
199
  label = doc.value
@@ -135,55 +218,42 @@ module Nicos
135
218
  XML::Parser::Options::NOENT
136
219
  )
137
220
 
138
- n = -1
139
- parsed = { "mylist" => {}, "entry" => [{}] }
221
+ n = 0
222
+ parsed = { :mylist => {}, :entry => [{}] }
223
+
140
224
  while doc.read
225
+ break if doc.name === "entry"
226
+
141
227
  unless doc.node_type == XML::Reader::TYPE_END_ELEMENT
142
- case doc.name
143
-
228
+ row = case doc.name
229
+ when "title" then
230
+ /(マイリスト )(.+)(‐ニコニコ動画)/ =~ parseRow(:title, :String, doc)[:title]
231
+ { :title => $2 }
232
+ when "id" then parseRow(:mylist_id, :mylistId,doc)
233
+ when "subtitle" then parseRow(:description, :String, doc)
234
+ when "updated" then parseRow(:updated, :ISO8601, doc)
235
+ when "name" then parseRow(:author, :String, doc)
236
+ end
237
+
238
+ parsed[:mylist].update(row) if row != nil
239
+ end
240
+ end
241
+
242
+ while doc.read
243
+ unless doc.node_type == XML::Reader::TYPE_END_ELEMENT
244
+ # bump up the page number
245
+ if doc.name === "entry"
246
+ n += 1
247
+ parsed[:entry][n] = {}
248
+ end
249
+
250
+ row = case doc.name
144
251
  # <title> and <id> are marked up both in mylist and
145
252
  # each entry's node. So we need to assign the value to the
146
253
  # appropriate variable in accordance with node's location.
147
- when "title"
148
- if n == -1
149
- doc.read
150
- d = doc.value
151
- tmp = doc.value.slice(6, 99)
152
- tmp = tmp.slice(0, tmp.length - 7)
153
- parsed["mylist"]["title"] = tmp
154
- else
155
- doc.read
156
- parsed["entry"][n]["title"] = doc.value
157
- end
158
- when "link"
159
- if n != -1
160
- doc.move_to_attribute("href")
161
- parsed["entry"][n]["video_id"] =
162
- Nicos::Extractor.videoId(doc.value)
163
- end
164
- when "subtitle"
165
- doc.read
166
- parsed["mylist"]["description"] = doc.value
167
- when "id"
168
- if n == -1
169
- doc.read
170
- parsed["mylist"]["mylist_id"] =
171
- Nicos::Extractor.mylistId(doc.value)
172
- else
173
- doc.read
174
- parsed["entry"][n]["item_id"] =
175
- Nicos::Extractor.itemId(doc.value)
176
- end
177
- when "updated"
178
- doc.read
179
- parsed["mylist"]["updated"] =
180
- Nicos::Converter.iso8601ToUnix(doc.value)
181
- when "name"
182
- doc.read
183
- parsed["mylist"]["author"] = doc.value
184
- when "entry"
185
- n += 1
186
- parsed["entry"][n] = {}
254
+ when "title" then parseRow(:title, :String, doc)
255
+ when "link" then parseRow(:video_id, :videoId, doc)
256
+ when "id" then parseRow(:item_id, :itemId, doc)
187
257
  when "content"
188
258
  doc.read
189
259
  html = doc.value
@@ -194,7 +264,7 @@ module Nicos
194
264
  /(<p\sclass=\"nico-thumbnail\">.+src=\")(http:\/\/[^\"]{1,})/ =~ html
195
265
  thumbnail_url = $2
196
266
 
197
- /(<p\sclass\=\"nico-description\"\>)([^\<]{1,})/ =~ html
267
+ /(<p\sclass=\"nico-description\"\>)([^\<]{1,})/ =~ html
198
268
  description = $2
199
269
 
200
270
  /(<strong\sclass\=\"nico-info-length\"\>)([^\<]{1,})/ =~ html
@@ -212,18 +282,22 @@ module Nicos
212
282
  /(<strong\sclass\=\"nico-numbers-mylist\"\>)([^\<]{1,})/ =~ html
213
283
  mylist = Nicos::Converter.commaRemover($2)
214
284
 
215
- parsed["entry"][n]["memo"] = memo
216
- parsed["entry"][n]["thumbnail_url"] = thumbnail_url
217
- parsed["entry"][n]["description"] = description
218
- parsed["entry"][n]["length"] = length
219
- parsed["entry"][n]["first_retrieve"] = first_retrieve
220
- parsed["entry"][n]["view"] = view
221
- parsed["entry"][n]["res"] = res
222
- parsed["entry"][n]["mylist"] = mylist
223
- end
285
+ {
286
+ :memo => memo,
287
+ :thumbnail_url => thumbnail_url,
288
+ :description => description,
289
+ :length => length,
290
+ :first_retrieve => first_retrieve,
291
+ :view => view,
292
+ :res => res,
293
+ :mylist => mylist
294
+ }
295
+ end
296
+
297
+ parsed[:entry][n].update(row) if row != nil
224
298
  end
225
299
  end
226
-
300
+
227
301
  doc.close
228
302
  parsed
229
303
  end
@@ -18,35 +18,35 @@ module Nicos
18
18
  paramAry = []
19
19
 
20
20
  case sort
21
- when 'comment_new'
21
+ when :comment_new
22
22
  sortStr = ''
23
- when 'comment_old'
23
+ when :comment_old
24
24
  sortStr = 'order=a'
25
- when 'view_many'
25
+ when :view_many
26
26
  sortStr = 'sort=v'
27
- when 'view_few'
27
+ when :view_few
28
28
  sortStr = 'sort=v&order=a'
29
- when 'comment_many'
29
+ when :comment_many
30
30
  sortStr = 'sort=r'
31
- when 'comment_few'
31
+ when :comment_few
32
32
  sortStr = 'sort=r&order=a'
33
- when 'mylist_many'
33
+ when :mylist_many
34
34
  sortStr = 'sort=m'
35
- when 'mylist_few'
35
+ when :mylist_few
36
36
  sortStr = 'sort=m&order=a'
37
- when 'post_new'
37
+ when :post_new
38
38
  sortStr = 'sort=f'
39
- when 'post_old'
39
+ when :post_old
40
40
  sortStr = 'sort=f&order=a'
41
- when 'length_long'
41
+ when :length_long
42
42
  sortStr = 'sort=l'
43
- when 'length_short'
43
+ when :length_short
44
44
  sortStr = 'sort=l&order=a'
45
45
  end
46
46
 
47
47
  paramAry.push("page=#{@page}") if @page != 1
48
48
  paramAry.push(sortStr)
49
- paramAry.push("rss=atom&numbers=1") if method == "atom"
49
+ paramAry.push("rss=atom&numbers=1") if method == :atom
50
50
  param = tag + "?" + paramAry.join('&')
51
51
 
52
52
  host = 'www.nicovideo.jp'
@@ -67,20 +67,20 @@ module Nicos
67
67
  method
68
68
  )
69
69
 
70
- if response["order"] == "afterTheSuccess"
71
- result = parse(response["body"])
70
+ if response[:order] == :afterTheSuccess
71
+ result = parse(response[:body])
72
72
  result.each { |each|
73
- movie = Nicos::Movie.new(each["video_id"])
74
- each["available"] = true
73
+ movie = Nicos::Movie.new(each[:video_id])
74
+ each[:available] = true
75
75
  movie.set(each)
76
76
  movieObjAry.push(movie)
77
77
  }
78
- elsif response["order"] == "terminate"
78
+ elsif response[:order] == :terminate
79
79
  puts "Request loop terminated."
80
80
  break
81
81
  end
82
82
 
83
- status = {"page" => @page, "results" => @connector.result}
83
+ status = { :page => @page, :results => @connector.result}
84
84
  order = block.call(movieObjAry, status)
85
85
  @page += 1
86
86
  end until order != "continue"
@@ -96,7 +96,7 @@ module Nicos
96
96
  @numOfSearched = 32
97
97
  @incrAmt = 0.2
98
98
 
99
- @connector = Nicos::Connector.new('mech')
99
+ @connector = Nicos::Connector.new(:mech)
100
100
 
101
101
  # HTML中の各パラメータの所在を示すXPath
102
102
  @videoIdXP = "//div[@class='uad_thumbfrm']/table/tr/td/p/a"
@@ -127,12 +127,12 @@ module Nicos
127
127
  .text.gsub(/\,/, '').to_i
128
128
 
129
129
  result.push({
130
- "video_id" => video_id,
131
- "length" => length,
132
- "view" => view,
133
- "res" => res,
134
- "mylist" => mylist,
135
- "ad" => ad
130
+ :video_id => video_id,
131
+ :length => length,
132
+ :view => view,
133
+ :res => res,
134
+ :mylist => mylist,
135
+ :ad => ad
136
136
  })
137
137
  end
138
138
 
@@ -142,7 +142,7 @@ module Nicos
142
142
  # @param [String] sortMethod
143
143
  # @param [HashObj] waitConfig
144
144
  def execute(tag, sortMethod, &block)
145
- loop(tag, sort, "mech") { |result, page|
145
+ loop(tag, sort, :mech) { |result, page|
146
146
  block.call(result, page)
147
147
  }
148
148
  end
@@ -168,79 +168,81 @@ module Nicos
168
168
  # タグ検索を実行し、ブロックに結果を渡します。
169
169
  #
170
170
  # @param [String] tag 検索したいタグ文字列
171
- # @param [String] sortMethod ソート方法
171
+ # @param [Symbol] sortMethod ソート方法
172
172
  #==基本的な使い方
173
- # require 'nicoscraper'
174
- #
175
- # searcher = Nicos::Searcher::ByTag.new()
176
- # searcher.execute('VOCALOID', 'view_many') {
177
- # |result, page|
178
- #
179
- # result.each { |movieObj|
180
- # puts movieObj.title
181
- # }
182
- # }
173
+ # require 'nicoscraper'
174
+ #
175
+ # searcher = Nicos::Searcher::ByTag.new()
176
+ # searcher.execute('VOCALOID', :view_many) {
177
+ # |result, status|
178
+ #
179
+ # result.each { |movieObj|
180
+ # puts movieObj.title
181
+ # }
182
+ # }
183
183
  #
184
- # result ----
184
+ # result ----
185
185
  #
186
- # 【初音ミク】みくみくにしてあげる♪【してやんよ】
187
- # 初音ミク が オリジナル曲を歌ってくれたよ「メルト」
188
- # 初音ミク が オリジナル曲を歌ってくれたよ「ワールドイズマイン」
189
- # 初音ミクオリジナル曲 「初音ミクの消失(LONG VERSION)」
190
- # 【巡音ルカ】ダブルラリアット【オリジナル】
191
- # 「卑怯戦隊うろたんだー」をKAITO,MEIKO,初音ミクにry【オリジナル】修正版
192
- # 【オリジナル曲PV】マトリョシカ【初音ミク・GUMI】
193
- # 初音ミクがオリジナルを歌ってくれたよ「ブラック★ロックシューター」
194
- # ...
186
+ # 【初音ミク】みくみくにしてあげる♪【してやんよ】
187
+ # 初音ミク が オリジナル曲を歌ってくれたよ「メルト」
188
+ # 初音ミク が オリジナル曲を歌ってくれたよ「ワールドイズマイン」
189
+ # 初音ミクオリジナル曲 「初音ミクの消失(LONG VERSION)」
190
+ # 【巡音ルカ】ダブルラリアット【オリジナル】
191
+ # 「卑怯戦隊うろたんだー」をKAITO,MEIKO,初音ミクにry【オリジナル】修正版
192
+ # 【オリジナル曲PV】マトリョシカ【初音ミク・GUMI】
193
+ # 初音ミクがオリジナルを歌ってくれたよ「ブラック★ロックシューター」
194
+ # ...
195
195
  #
196
- # Nicos::Searcher::ByTagのインスタンスを作り、executeメソッドに引数を与えて実行します。
196
+ #  Nicos::Searcher::ByTagのインスタンスを作り、executeメソッドに引数を与えて実行します。
197
197
  # 結果がブロックの第1仮引数に渡されます。
198
198
  # 渡される結果はMovieクラスのインスタンスを含む配列です。
199
199
  #
200
200
  #==スクレイプの継続について
201
201
  #
202
- # ニコニコ動画の検索結果は、指定した数を一度に取得できる訳ではありません。
202
+ #  ニコニコ動画の検索結果は、指定した数を一度に取得できる訳ではありません。
203
203
  # なぜなら、現状では検索結果はHTML1ページ、もしくは1つのRSS/Atomフィードに32個を限度に渡される方式であり、
204
204
  # ByTagクラスがその結果を利用する以上、32個=1単位という制約のもとに置かれるからです。
205
- # 従って、例えば最新の投稿100個の情報が欲しいとしても、1回のリクエストでは手に入らず
205
+ # 従って、例えば最新の投稿100個の情報が欲しいとしても、1回のリクエストでは手に入らず、
206
206
  # かならず数回に分けてリクエストすることになります。
207
207
  #
208
208
  # 加えて、リクエストを継続するかどうかの判定も1ページ/1フィード毎に行います。
209
209
  #==sortMethod: ソート方法
210
- # *comment_new*
210
+ #  以下のシンボルを指定して下さい。
211
+ #
212
+ # *:comment_new*
211
213
  # コメントが新しい順
212
214
  #
213
- # *comment_old*
215
+ # *:comment_old*
214
216
  # コメントが新しい順
215
217
  #
216
- # *view_many*
218
+ # *:view_many*
217
219
  # 再生数が多い順
218
220
  #
219
- # *view_few*
221
+ # *:view_few*
220
222
  # 再生数が少ない順
221
223
  #
222
- # *comment_many*
224
+ # *:comment_many*
223
225
  # コメントが多い順
224
226
  #
225
- # *comment_few*
227
+ # *:comment_few*
226
228
  # コメントが少ない順
227
229
  #
228
- # *mylist_many*
230
+ # *:mylist_many*
229
231
  # マイリスト登録が多い順
230
232
  #
231
- # *mylist_few*
233
+ # *:mylist_few*
232
234
  # マイリスト登録が少ない順
233
235
  #
234
- # *post_new*
236
+ # *:post_new*
235
237
  # 登録が新しい順
236
238
  #
237
- # *post_old*
239
+ # *:post_old*
238
240
  # 登録が少ない順
239
241
  #
240
- # *length_long*
242
+ # *:length_long*
241
243
  # 再生時間が長い順
242
244
  #
243
- # *length_short*
245
+ # *:length_short*
244
246
  # 再生時間が短い順
245
247
  #
246
248
  # @param [HashObj] waitConfig ウェイト設定
@@ -252,33 +254,89 @@ module Nicos
252
254
  # 変更したい部分のキーと値のみを持つハッシュオブジェクトを作って下さい。
253
255
  #
254
256
  # @waitConfig = {
255
- # 'seqAccLimit' => 10, # 連続してリクエストする回数
256
- # 'afterSeq' => 10, # 連続リクエスト後のウェイト(以下、単位は全て秒)
257
- # 'each' => 1, # 連続リクエスト時の、1リクエスト毎のウェイト
258
- # 'increment' => 1, # アクセス拒絶時の、次回以降の1リクエスト毎のウェイトの増加量
257
+ # :seqAccLimit => 10, # 連続してリクエストする回数
258
+ # :afterSeq => 10, # 連続リクエスト後のウェイト(以下、単位は全て秒)
259
+ # :each => 1, # 連続リクエスト時の、1リクエスト毎のウェイト
260
+ # :increment => 1, # アクセス拒絶時の、次回以降の1リクエスト毎のウェイトの増加量
259
261
  #
260
- # 'deniedSeqReq'=> { # 連続アクセスを拒否された際の設定(以下同じ)
261
- # 'retryLimit' => 3, # 再試行の上限回数
262
- # 'wait' => 120 # 次のアクセスまでのウェイト
262
+ # :deniedSeqReq=> { # 連続アクセスを拒否された際の設定(以下同じ)
263
+ # :retryLimit => 3, # 再試行の上限回数
264
+ # :wait => 120 # 次のアクセスまでのウェイト
263
265
  # },
264
266
  #
265
- # 'serverIsBusy'=> { # サーバ混雑時
266
- # 'retryLimit' => 3,
267
- # 'wait' => 120
267
+ # :serverIsBusy=> { # サーバ混雑時
268
+ # :retryLimit => 3,
269
+ # :wait => 120
268
270
  # },
269
271
  #
270
- # 'serviceUnavailable' => { # 503が返ってきた時
271
- # 'retryLimit' => 3,
272
- # 'wait' => 120
272
+ # :serviceUnavailable => { # 503が返ってきた時
273
+ # :retryLimit => 3,
274
+ # :wait => 120
273
275
  # },
274
276
  #
275
- # 'timedOut' => { # タイムアウト時
276
- # 'retryLimit' => 3,
277
- # 'wait' => 10
277
+ # :timedOut => { # タイムアウト時
278
+ # :retryLimit => 3,
279
+ # :wait => 10
278
280
  # }
279
281
  # }
282
+ #
283
+ #==ブロック内の第2引数について
284
+ #
285
+ # 第2引数には、それまでの検索の成否、例外の発生回数などを記録した
286
+ # ハッシュが渡されます。これは以下のような構造になっています。
287
+ #
288
+ # {
289
+ # # 各種例外等が発生した動画・マイリストのIDを配列で保管。
290
+ # :notPublic => [],
291
+ # :limInCommunity => [],
292
+ # :notFound => [],
293
+ # :deleted => [],
294
+ #
295
+ # # 再試行で対処できる例外等が発生した件数。
296
+ # :deniedSeqReq => 0,
297
+ # :serverIsBusy => 0,
298
+ # :serviceUnavailable => 0,
299
+ # :timedOut => 0,
300
+ #
301
+ # # 成功回数
302
+ # :succeededNum => 0
303
+ # }
304
+ #
305
+ # *allDisabled*
306
+ #  マイリストの場合のみ機能。そのマイリスト内の動画が全て非公開、
307
+ # あるいは削除済み等で存在しないが、マイリストは残っている場合。
308
+ #
309
+ # *notPublic*
310
+ #  動画、マイリストが非公開である場合。
311
+ #
312
+ # *limInCommunity*
313
+ #  動画、マイリストがコミュニティ限定公開である場合。
314
+ #
315
+ # *notFound*
316
+ #  動画、マイリストが存在しない場合。マイリストは削除済みの場合もnotFoundとなる。
317
+ #
318
+ # *deleted*
319
+ #  その動画が削除済みである場合。マイリストについては、上のnotFoundと
320
+ # 区別されない。
321
+ #
322
+ # *deniedSeqReq*
323
+ #  連続アクセスとして明示的に拒否された場合。
324
+ #
325
+ # *serverIsBusy*
326
+ #  「大変ご迷惑をおかけいたしますが、しばらく時間をあけてから
327
+ # 再度検索いただくようご協力をお願いいたします。」と表示される場合。
328
+ #
329
+ # *serviceUnavailable*
330
+ #  503が返ってきた時。
331
+ #
332
+ # *timedOut*
333
+ #  タイムアウト
334
+ #
335
+ # *succeededNum*
336
+ #  成功回数
337
+ #==
280
338
  def execute(tag, sortMethod, &block)
281
- loop(tag, sortMethod, "atom") { |result, page|
339
+ loop(tag, sortMethod, :atom) { |result, page|
282
340
  block.call(result, page)
283
341
  }
284
342
  end