rget 3.2.2 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/nicodl +6 -1
  3. data/lib/nicovideo.rb +6 -5
  4. data/rget.gemspec +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5d94395e37aedae394a092e270ca697693fb292
4
- data.tar.gz: '091690795ba62f0e830c07dc4ddee6a8b4c51bf1'
3
+ metadata.gz: d1629be674db949cb4fc135e09f2fb0333b93afd
4
+ data.tar.gz: 2d31880ccb2cd7e51f54698ff352331a51907fc5
5
5
  SHA512:
6
- metadata.gz: 422e6728292d02db948615898588d408dd8676a6f1163328a66087b5d7365b9bf368861f6070089a2d3e769643916e2821c2d0a33f6b4d63463bb767f5d60e24
7
- data.tar.gz: d3c1665186d97f2ef83795e2c0adc455c818f86e9b35b56ba8624b6179cd393946b9cf7385810e4749f05c66caf9ef8eea5757e95d50fc33962c129d48571012
6
+ metadata.gz: 6927b79d9651ef8d5d18f0e03bb7c15b55779bc9942172b2ea30a0aeab738d26ec9337f7c668b4e4cebb6f1275d0f97c1094262749ec2e18d93850fb78fb4230
7
+ data.tar.gz: 9f10d8a3da090ece4ae60d16e85083c1c421da16c003c4373d17631e1441a8a1e02e6467f18f1e404f5ec052c18e6a05c07184b66d65cbd9759743acde70c5a1
data/bin/nicodl CHANGED
@@ -5,6 +5,11 @@ require 'niconico'
5
5
  require 'pathname'
6
6
  require 'open3'
7
7
 
8
+ def alt_title(video_id)
9
+ xml = open("http://ext.nicovideo.jp/api/getthumbinfo/#{video_id}").read
10
+ xml.scan(%r|<title>(.*)</title>|m).flatten.first || video_id
11
+ end
12
+
8
13
  if ARGV.size == 0
9
14
  $stderr.puts "usage: nicodl <URL> [URL...]"
10
15
  exit -1
@@ -34,7 +39,7 @@ ARGV.each do |player_url|
34
39
  begin
35
40
  # downloading video
36
41
  video = nico.video(video_id)
37
- file = "#{video.title || 'unknown'}.#{video.type}".gsub(%r([\\/\?:*"'><|]), '_')
42
+ file = "#{video.title || alt_title(video_id)}.#{video.type}".gsub(%r([\\/\?:*"'><|]), '_')
38
43
  open(file, 'wb:ASCII-8BIT') do |o|
39
44
  video.get_video{|body|o.write(body)}
40
45
  end
data/lib/nicovideo.rb CHANGED
@@ -23,8 +23,9 @@ class Nicovideo < WebRadio
23
23
  raise DownloadError.new('video not found')
24
24
  end
25
25
 
26
- video = @nico.video(Pathname(URI(player_url).path).basename.to_s)
27
- title = video.title || alt_title(player_url)
26
+ video_id = Pathname(URI(player_url).path).basename.to_s
27
+ video = @nico.video(video_id)
28
+ title = video.title || alt_title(video_id)
28
29
  title.tr!('0-9', '0-9')
29
30
  serial = title.scan(/(?:[#第]|[  ]EP|track-)(\d+)|/).flatten.compact[0].to_i
30
31
  appendix = title =~ /おまけ|アフタートーク/ ? 'a' : ''
@@ -75,8 +76,8 @@ private
75
76
  end
76
77
  end
77
78
 
78
- def alt_title(player_url)
79
- html = open(player_url).read
80
- html.scan(%r|<title>(.*)</title>|m).flatten.first || ''
79
+ def alt_title(video_id)
80
+ xml = open("http://ext.nicovideo.jp/api/getthumbinfo/#{video_id}").read
81
+ xml.scan(%r|<title>(.*)</title>|m).flatten.first || video_id
81
82
  end
82
83
  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.2.2"
7
+ spec.version = "3.2.3"
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.2.2
4
+ version: 3.2.3
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-07-13 00:00:00.000000000 Z
11
+ date: 2017-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor