rget 3.0.2 → 3.1.0
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 +4 -4
- data/bin/nicodl +50 -46
- data/rget.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1036d1b31cf0c12651c08e002dcf385d11101233
|
4
|
+
data.tar.gz: 92c4cd83fd3b35c15f255c28413661bc000e4f45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09b0fd82e8aad1d1c545f6242b56134d80bd935f5e3408c502244730c66c1f8021525467e230ba0df0aa1376c68a0f07b0fc7cc804ce0e6eb13e02c5b8ebfbf5'
|
7
|
+
data.tar.gz: 6ea0a06f15fe8679a8d333145cde5b4a7bc589b177dd2efc796bef22f7c2436eee08be1d830da2cd66565d787e7dff93126db9fc23e6e4fb64c317620837858c
|
data/bin/nicodl
CHANGED
@@ -5,11 +5,11 @@ require 'niconico'
|
|
5
5
|
require 'pathname'
|
6
6
|
require 'open3'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
$stderr.puts "usage: nicodl <URL>"
|
8
|
+
if ARGV.size == 0
|
9
|
+
$stderr.puts "usage: nicodl <URL> [URL...]"
|
11
10
|
exit -1
|
12
11
|
end
|
12
|
+
|
13
13
|
account = Pit::get('nicovideo', :require => {
|
14
14
|
:id => 'your nicovideo id',
|
15
15
|
:pass => 'your nicovideo password'
|
@@ -25,59 +25,63 @@ rescue Mechanize::ResponseReadError
|
|
25
25
|
sleep 5
|
26
26
|
retry
|
27
27
|
end
|
28
|
+
$stderr.puts 'login faiure.'
|
29
|
+
exit -2
|
28
30
|
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
# downloading video
|
33
|
-
video = nico.video(video_id)
|
34
|
-
file = "#{video.title}.#{video.type}".gsub(%r([\\/\?:*"'><|]), '_')
|
35
|
-
open(file, 'wb:ASCII-8BIT') do |o|
|
36
|
-
video.get_video{|body|o.write(body)}
|
37
|
-
end
|
38
|
-
rescue Mechanize::ResponseCodeError, Errno::EISDIR
|
39
|
-
# live streaming time-shift
|
40
|
-
live = nico.live(video_id)
|
32
|
+
ARGV.each do |player_url|
|
33
|
+
video_id = Pathname(URI(player_url).path).basename.to_s
|
41
34
|
begin
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
35
|
+
# downloading video
|
36
|
+
video = nico.video(video_id)
|
37
|
+
file = "#{video.title}.#{video.type}".gsub(%r([\\/\?:*"'><|]), '_')
|
38
|
+
open(file, 'wb:ASCII-8BIT') do |o|
|
39
|
+
video.get_video{|body|o.write(body)}
|
40
|
+
end
|
41
|
+
rescue Mechanize::ResponseCodeError, Errno::EISDIR
|
42
|
+
# live streaming time-shift
|
43
|
+
live = nico.live(video_id)
|
44
|
+
begin
|
45
|
+
live.rtmpdump_commands(video_id).each_with_index do |cmd, i|
|
46
|
+
src = "#{video_id}-#{i+1}.flv"
|
47
|
+
dst = "#{live.title.gsub(%r([\\/\?:*"'><|]), '_')}-#{i+1}.mp4"
|
48
|
+
unless File.exist?(src)
|
49
|
+
cmd[cmd.index('-o') + 1] = "./#{src}"
|
50
|
+
begin
|
51
|
+
o, e, s = Open3.capture3(*cmd)
|
52
|
+
unless s.exitstatus == 0
|
53
|
+
$stderr.puts e
|
54
|
+
next
|
55
|
+
end
|
56
|
+
rescue Errno::ENOENT # rtmdump command not found
|
57
|
+
$stderr.puts $!
|
58
|
+
exit 1
|
59
|
+
end
|
60
|
+
else
|
61
|
+
$stderr.puts "#{src} is existent. skipping."
|
62
|
+
end
|
63
|
+
|
64
|
+
cmd = 'ffmpeg'
|
65
|
+
args = ['-i', src, '-acodec', 'copy', '-vcodec', 'copy', dst]
|
47
66
|
begin
|
48
|
-
o, e, s = Open3.capture3(*
|
67
|
+
o, e, s = Open3.capture3(cmd, *args)
|
49
68
|
unless s.exitstatus == 0
|
50
69
|
$stderr.puts e
|
51
70
|
next
|
52
71
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
cmd = 'ffmpeg'
|
62
|
-
args = ['-i', src, '-acodec', 'copy', '-vcodec', 'copy', dst]
|
63
|
-
begin
|
64
|
-
o, e, s = Open3.capture3(cmd, *args)
|
65
|
-
unless s.exitstatus == 0
|
66
|
-
$stderr.puts e
|
67
|
-
next
|
68
|
-
end
|
69
|
-
File.delete(src)
|
70
|
-
rescue Errno::ENOENT
|
71
|
-
if cmd == 'avconv'
|
72
|
-
$stderr.puts "ffmpeg or avconv not found."
|
73
|
-
else # retry with avconv command instead of ffmpeg
|
74
|
-
cmd = 'avconv'
|
75
|
-
retry
|
72
|
+
File.delete(src)
|
73
|
+
rescue Errno::ENOENT
|
74
|
+
if cmd == 'avconv'
|
75
|
+
$stderr.puts "ffmpeg or avconv not found."
|
76
|
+
else # retry with avconv command instead of ffmpeg
|
77
|
+
cmd = 'avconv'
|
78
|
+
retry
|
79
|
+
end
|
76
80
|
end
|
77
81
|
end
|
82
|
+
rescue Niconico::Live::TicketRetrievingFailed
|
83
|
+
$stderr.puts $!
|
84
|
+
exit 2
|
78
85
|
end
|
79
|
-
rescue Niconico::Live::TicketRetrievingFailed
|
80
|
-
$stderr.puts $!
|
81
|
-
exit 2
|
82
86
|
end
|
83
87
|
end
|
data/rget.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rget"
|
7
|
-
spec.version = "3.0
|
7
|
+
spec.version = "3.1.0"
|
8
8
|
spec.authors = ["TADA Tadashi"]
|
9
9
|
spec.email = ["t@tdtds.jp"]
|
10
10
|
spec.description = %q{Downloading newest radio programs on the web. Supported radio stations are hibiki, animate, onsen, seaside communications and niconico.}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TADA Tadashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
172
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.6.
|
173
|
+
rubygems_version: 2.6.11
|
174
174
|
signing_key:
|
175
175
|
specification_version: 4
|
176
176
|
summary: Downloading newest radio programs on the web.
|