nicovideo 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nicovideo/version.rb +1 -1
- data/lib/nicovideo/video.rb +1 -2
- data/lib/nicovideo/videopage.rb +12 -1
- data/sample/nv_download.rb +11 -0
- data/sample/nv_download2.rb +0 -2
- metadata +2 -2
data/lib/nicovideo/version.rb
CHANGED
data/lib/nicovideo/video.rb
CHANGED
data/lib/nicovideo/videopage.rb
CHANGED
@@ -15,6 +15,17 @@ module Nicovideo
|
|
15
15
|
|
16
16
|
attr_reader :video_id
|
17
17
|
|
18
|
+
def exists?()
|
19
|
+
begin
|
20
|
+
@page = @page || get_page
|
21
|
+
return true
|
22
|
+
rescue
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def id() @video_id end
|
28
|
+
|
18
29
|
def comments(num=500)
|
19
30
|
puts_info 'getting comment xml : id = ' + @video_id
|
20
31
|
begin
|
@@ -38,7 +49,7 @@ module Nicovideo
|
|
38
49
|
@params = @params || get_params
|
39
50
|
video_url = CGI.unescape(@params['url'])
|
40
51
|
video_flv = @agent.get_file(video_url)
|
41
|
-
|
52
|
+
video_flv
|
42
53
|
end
|
43
54
|
end
|
44
55
|
|
data/sample/nv_download.rb
CHANGED
@@ -16,10 +16,21 @@ nv = Nicovideo.new(mail, password).login
|
|
16
16
|
video_ids.each {|video_id|
|
17
17
|
|
18
18
|
nv.watch(video_id) {|v|
|
19
|
+
# method 'id' and 'video_id' return video ID(string).
|
20
|
+
puts 'video id = ' + v.id
|
21
|
+
|
22
|
+
# method 'title' returns string.
|
19
23
|
puts 'title = ' + v.title
|
24
|
+
|
25
|
+
# method 'tags' returns array of string.
|
20
26
|
puts 'tags = ' + v.tags.join(' ')
|
27
|
+
|
28
|
+
# method 'comments' returns instance of class Comments
|
29
|
+
# which has methods 'to_xml', 'to_s'(same).
|
21
30
|
puts 'getting comments xml'
|
22
31
|
File.open("#{video_id}.xml", "wb") {|f| f.write v.comments(100).to_xml }
|
32
|
+
|
33
|
+
# method 'flv' and 'video' return raw flv data(binary).
|
23
34
|
puts 'getting flv file'
|
24
35
|
File.open("#{video_id}.flv", "wb") {|f| f.write v.flv }
|
25
36
|
}
|
data/sample/nv_download2.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: nicovideo
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2008-01-
|
6
|
+
version: 0.0.3
|
7
|
+
date: 2008-01-09 00:00:00 +09:00
|
8
8
|
summary: utils for nicovideo
|
9
9
|
require_paths:
|
10
10
|
- lib
|