rget 2.3.5 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hibiki.rb +60 -3
- data/rget.gemspec +1 -1
- data/rget.yaml +4 -8
- 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: c314c0cc43b10425e854cf72250fbda17ec7ff0b
|
4
|
+
data.tar.gz: e1def2c8c59cefdefbd30f067db66581e6773f6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bf4734ec1a293253c973914ad970e4e7d504fd5595b9832eff55929f65f4c4d3fe73d297c6fcb4124b46cf90f667145d34d487138e9735c2bd492c18b9920d0
|
7
|
+
data.tar.gz: 47a1e1a77cb2929b3a2074f1f065b8a0627f563eafe708eb61b2fc5863f0c43290af7cff4af69f07e2f3671ead09e55a008a23d3114d6b7b3a548736e3fe6b91
|
data/lib/hibiki.rb
CHANGED
@@ -1,9 +1,66 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'webradio'
|
4
|
+
require 'mechanize'
|
5
|
+
require 'json'
|
6
|
+
require 'uri'
|
7
|
+
require 'openssl'
|
4
8
|
|
5
|
-
class Hibiki <
|
9
|
+
class Hibiki < WebRadio
|
6
10
|
def download(name)
|
7
|
-
|
11
|
+
hibiki_download(name, @url.scan(%r|/([^/]*)$|).flatten.first)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def header
|
16
|
+
{
|
17
|
+
'X-Requested-With' => 'XMLHttpRequest',
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def hibiki_download(name, program_id)
|
22
|
+
agent = Mechanize.new
|
23
|
+
agent.request_headers = header
|
24
|
+
|
25
|
+
begin
|
26
|
+
media_info = JSON.parse(agent.get("https://vcms-api.hibiki-radio.jp/api/v1/programs/#{program_id}").body,{:symbolize_names => true})
|
27
|
+
serial = media_info[:episode][:name].scan(/(\d+)/).flatten.first
|
28
|
+
video_id = media_info[:episode][:video][:id]
|
29
|
+
|
30
|
+
video_info = JSON.parse(agent.get("https://vcms-api.hibiki-radio.jp/api/v1/videos/play_check?video_id=#{video_id}").body,{:symbolize_names => true})
|
31
|
+
playlist_url = video_info[:playlist_url]
|
32
|
+
m3u8_url = agent.get(playlist_url).body.scan(/http.*/).flatten.first
|
33
|
+
|
34
|
+
base_url = URI.parse(m3u8_url)
|
35
|
+
base_path = File.dirname(base_url.path)
|
36
|
+
|
37
|
+
m3u8 = agent.get(m3u8_url).body
|
38
|
+
key_url = m3u8.scan(/URI="(.*)"/).flatten.first
|
39
|
+
|
40
|
+
tses = m3u8.scan(/ts_.*\.ts/)
|
41
|
+
key = agent.get_file(key_url)
|
42
|
+
iv = m3u8.scan(/IV=0x(.*)$/).flatten.pack("H*")
|
43
|
+
rescue NoMethodError
|
44
|
+
raise NotFoundError.new("no radio program in #{program_id}.")
|
45
|
+
end
|
46
|
+
|
47
|
+
ts_file = "#{name}##{serial}.ts"
|
48
|
+
mp3_file = "#{name}##{serial}.mp3"
|
49
|
+
|
50
|
+
decoder = OpenSSL::Cipher.new('aes-128-cbc')
|
51
|
+
decoder.key = key
|
52
|
+
decoder.iv = iv
|
53
|
+
|
54
|
+
decoder.decrypt
|
55
|
+
|
56
|
+
mp3ize(ts_file, mp3_file) do
|
57
|
+
open(ts_file, 'wb:ASCII-8BIT') do |ts|
|
58
|
+
tses.each do |file|
|
59
|
+
base_url.path = "#{base_path}/#{file}"
|
60
|
+
ts.write(decoder.update(agent.get_file(base_url)))
|
61
|
+
end
|
62
|
+
ts.write(decoder.final)
|
63
|
+
end
|
64
|
+
end
|
8
65
|
end
|
9
66
|
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 = "2.3.
|
7
|
+
spec.version = "2.3.6"
|
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, niconico and youtube.}
|
data/rget.yaml
CHANGED
@@ -38,10 +38,6 @@ programs:
|
|
38
38
|
desc: ラジオ シドニアの騎士~綾と綾音の秘密の光合成~
|
39
39
|
url: http://www.onsen.ag/program/sidonia/
|
40
40
|
label: sidonia
|
41
|
-
aldnoah:
|
42
|
-
desc: アルドノア・ラジオ
|
43
|
-
url: http://www.onsen.ag/program/aldnoah/
|
44
|
-
label: アルドノア
|
45
41
|
taizai:
|
46
42
|
desc: ラジオ七つの大罪 <豚の帽子>亭ホークトーク
|
47
43
|
url: http://hibiki-radio.jp/description/taizai
|
@@ -54,10 +50,6 @@ programs:
|
|
54
50
|
desc: TrySailのTRYangle harmony
|
55
51
|
url: http://ch.nicovideo.jp/search/TrySail?channel_id=ch2585696&mode=s&sort=f&order=d&type=video
|
56
52
|
label: トラハモ
|
57
|
-
hibiki_challenge:
|
58
|
-
desc: 一番くじ&クレーンキングスペシャル〜響チャレンジ!
|
59
|
-
url: http://ch.nicovideo.jp/search/IDOLM@STER?channel_id=ch346&mode=s&sort=f&order=d&type=video
|
60
|
-
label: 響チャレンジ
|
61
53
|
greenight:
|
62
54
|
desc: 花澤香菜と雨宮天のRADIO GREE NIGHT
|
63
55
|
url: https://www.youtube.com/playlist?list=PLpAhJfIVc-EcAQXGGRlOir7ctL-wNCnoq
|
@@ -82,3 +74,7 @@ programs:
|
|
82
74
|
desc: アニメ SHOW BY ROCK!!
|
83
75
|
url: http://ch.nicovideo.jp/showbyrock_anime/video?rss=2.0
|
84
76
|
label: SHOWBYROCK
|
77
|
+
plamemo:
|
78
|
+
desc: ミチルとザックのプラメモラジオ
|
79
|
+
url: http://hibiki-radio.jp/description/plamemo
|
80
|
+
label: プラメモ
|
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: 2.3.
|
4
|
+
version: 2.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TADA Tadashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
187
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.4.5
|
188
|
+
rubygems_version: 2.4.5.1
|
189
189
|
signing_key:
|
190
190
|
specification_version: 4
|
191
191
|
summary: Downloading newest radio programs on the web.
|