rget 4.2.4 → 4.3.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/lib/nicovideo.rb +22 -17
- data/rget.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6fa9111f5bf98f850fe37ffb0ae7c527fb3388bf3727fbd2b0d57d2b3a1046f
|
4
|
+
data.tar.gz: 83a382e8df65d131a76e3dd657cfe166fd8b58f25677848ef152a7145e78e861
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3724a95a6b539622e5d40a2a48b4335db37c12308af3fd7f534193bc746c0b4ed6a5e10f6430fd2f31e9b59f6c5bf50b6961bc4064f513c8f52ff9af1711ecb
|
7
|
+
data.tar.gz: f95c9f32efb1ae8d00c039dae7bc80fd763b07446f1152985e23d1831e29d687c08e0f951c3fb535b73b106aa7de45548beae06971b1fec356c4175c1c2d07e7
|
data/lib/nicovideo.rb
CHANGED
@@ -18,15 +18,12 @@ class Nicovideo < WebRadio
|
|
18
18
|
|
19
19
|
def download
|
20
20
|
begin
|
21
|
-
|
21
|
+
video = get_video(@url)
|
22
22
|
rescue NoMethodError
|
23
23
|
raise DownloadError.new('video not found')
|
24
24
|
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
video = @nico.video(video_id)
|
29
|
-
title = video.title || thumbinfo(video_id, 'title') || video_id
|
25
|
+
@cover = thumbinfo(video, 'thumbnail_url') unless @cover
|
26
|
+
title = video.title || thumbinfo(video, 'title') || video.id
|
30
27
|
title.tr!('0-9', '0-9')
|
31
28
|
serial = title.scan(/(?:[#第]|[ ]EP|track-)(\d+)|/).flatten.compact[0].to_i
|
32
29
|
appendix = title =~ /おまけ|アフタートーク/ ? 'a' : ''
|
@@ -64,21 +61,29 @@ class Nicovideo < WebRadio
|
|
64
61
|
end
|
65
62
|
|
66
63
|
private
|
67
|
-
def
|
64
|
+
def get_video(list_url)
|
65
|
+
video_url = nil
|
66
|
+
offset = 0
|
68
67
|
begin
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
68
|
+
begin
|
69
|
+
rss = RSS::Parser.parse(list_url)
|
70
|
+
item = rss.items.first
|
71
|
+
video_url = item.link
|
72
|
+
rescue RSS::NotWellFormedError
|
73
|
+
html = open(list_url, &:read)
|
74
|
+
url = html.scan(%r|/watch/[\w]+|).first
|
75
|
+
raise WebRadio::DownloadError.new('video not found in this pege') unless url
|
76
|
+
video_url = "http://www.nicovideo.jp#{url}"
|
77
|
+
end
|
78
|
+
video = @nico.video(Pathname(URI(video_url).path).basename.to_s)
|
79
|
+
rescue Net::HTTPForbidden
|
80
|
+
offset += 1
|
81
|
+
return
|
77
82
|
end
|
78
83
|
end
|
79
84
|
|
80
|
-
def thumbinfo(
|
81
|
-
xml = open("http://ext.nicovideo.jp/api/getthumbinfo/#{
|
85
|
+
def thumbinfo(video, elem = nil)
|
86
|
+
xml = open("http://ext.nicovideo.jp/api/getthumbinfo/#{video.id}").read
|
82
87
|
if elem
|
83
88
|
return xml.scan(%r|<#{elem}>(.*)</#{elem}>|m).flatten.first
|
84
89
|
else
|
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 = "4.
|
7
|
+
spec.version = "4.3.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, onsen, niconico and freshlive.}
|
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: 4.
|
4
|
+
version: 4.3.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-
|
11
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|