rget 4.6.1 → 4.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8724d5e9d9cc41ac88e02daadf6beea6ddca2040b676f09a9d1a9be06792bed8
4
- data.tar.gz: 6ec002e98c4eef4010c5e7d2d3e30e05bc253db6e3b5b8a9f8bbc68b8a0c42a3
3
+ metadata.gz: 488a771cfb2710dcba48975c4cc4ec6c534d7a07454f261a7df0f59842068875
4
+ data.tar.gz: fc1cf924f09f46347e63f07bbfef2827f78b77d976cf4b9cece766e55bed37cc
5
5
  SHA512:
6
- metadata.gz: '059523e19ca5bfc9dbd2e17498c7c44d82de8cd0570415061d96f51d928b6a773df1ccf976995597b3eb9916f11808a562a4f3c4dfd0b3bc2b1d9d10153ba33b'
7
- data.tar.gz: 749be7f67700bd1e885b4e92675c6d677018e63f7e1431667ee59d6ae8e6bc82105349c3e0047efaebd9894b339fd0fe8433d4f79c253fa33bf88dce6b77278f
6
+ metadata.gz: a20dcb464d97c34152b062d91af835bb9bc305528383f233782613d39b56ad9a643033e3b35b2580e9eb1a637770c61eda41b60f98866496b7d995ae2bc1ef0c
7
+ data.tar.gz: d03c0e1f083e3c6ead6e9d6c62485b9d5b4d66c7b900c5f09d0f6ae3d81c0a5e21b4a65609890afd15312bfd3d394d364116c375ef231b6bcf78362b69348f90
data/README.md CHANGED
@@ -7,6 +7,7 @@ Downloading newest radio programs on the web. Supported radio stations are:
7
7
  * niconico
8
8
  * freshlive.tv
9
9
  * himalaya.fm
10
+ * Abobi Store
10
11
 
11
12
  If you want to save files as MP3, needs `ffmpeg` command.
12
13
 
data/bin/rget CHANGED
@@ -40,9 +40,9 @@ class GetWebRadio < Thor
40
40
  else
41
41
  WebRadio(params, opts){|media|media.download}
42
42
  end
43
- rescue WebRadio::NotFoundError => e
44
- $stderr.puts e.message
45
- rescue WebRadio::DownloadError => e
43
+ rescue WebRadio::NotFoundError,
44
+ WebRadio::DownloadError,
45
+ WebRadio::UnsupportError => e
46
46
  $stderr.puts e.message
47
47
  end
48
48
  end
data/lib/asobistore.rb ADDED
@@ -0,0 +1,55 @@
1
+ require 'open-uri'
2
+ require 'nokogiri'
3
+ require 'mechanize'
4
+
5
+ class AsobiStore < WebRadio
6
+ def initialize(params, options)
7
+ super
8
+ @offset = 0
9
+ end
10
+
11
+ def download
12
+ list = Nokogiri(open(@url).read)
13
+ program = list.css('.list-main-product a.wrap').first.attr('href')
14
+ content = Nokogiri(open("https://asobistore.jp#{program}").read)
15
+ player = content.css('iframe').last.attr('src')
16
+ html = Nokogiri(open("https:#{player}").read)
17
+ src_m3u8 = html.css('source').first.attr('src')
18
+ m3u8 = "#{File.dirname(src_m3u8)}/#{open(src_m3u8).read.match(/^[^#].*/)[0]}"
19
+
20
+ serial = html.title.scan(/#(\d+)/).flatten.first.to_i
21
+ @cover = "https:#{html.css('audio').first.attr('poster')}" unless @cover
22
+ ts_file = "#{@label}##{serial}.ts"
23
+ mp3_file = "#{@label}##{serial}.mp3"
24
+
25
+ begin
26
+ agent = Mechanize.new
27
+ agent.get(m3u8)
28
+ body = agent.page.body
29
+ rescue ArgumentError
30
+ body = open(m3u8, &:read)
31
+ end
32
+ tses = body.scan(/.*\.ts.*/)
33
+ key_url = body.scan(/URI="(.*)"/).flatten.first
34
+
35
+ if key_url
36
+ key = agent.get_file(key_url)
37
+ decoder = OpenSSL::Cipher.new('aes-128-cbc')
38
+ decoder.key = key
39
+ decoder.decrypt
40
+ else
41
+ decoder = ''
42
+ def decoder.update(s); return s; end
43
+ end
44
+
45
+ mp3nize(ts_file, mp3_file) do
46
+ open(ts_file, 'wb:ASCII-8BIT') do |ts|
47
+ tses.each_with_index do |file, count|
48
+ print "." if count % 10 == 0
49
+ ts.write(decoder.update(agent.get_file(file)))
50
+ end
51
+ ts.write(decoder.final)
52
+ end
53
+ end
54
+ end
55
+ end
data/lib/webradio.rb CHANGED
@@ -7,6 +7,7 @@ require 'mp3info'
7
7
  class WebRadio
8
8
  class NotFoundError < StandardError; end
9
9
  class DownloadError < StandardError; end
10
+ class UnsupportError < StandardError; end
10
11
 
11
12
  def self.instance(params, options)
12
13
  case params['url']
@@ -25,8 +26,11 @@ class WebRadio
25
26
  when %r[^http://m\.himalaya\.fm/]
26
27
  require 'himalaya'
27
28
  Himalaya.new(params, options)
29
+ when %r[^https://asobistore\.jp/]
30
+ require 'asobistore'
31
+ AsobiStore.new(params, options)
28
32
  else
29
- raise "unsupported url: #{params['url']}"
33
+ raise UnsupportError, "unsupported url: #{params['url']}"
30
34
  end
31
35
  end
32
36
 
data/rget.gemspec CHANGED
@@ -4,10 +4,10 @@ $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.6.1"
7
+ spec.version = "4.7.0"
8
8
  spec.authors = ["TADA Tadashi"]
9
9
  spec.email = ["t@tdtds.jp"]
10
- spec.description = %q{Downloading newest radio programs on the web. Supported radio stations are hibiki, onsen, niconico, freshlive and himalaya.}
10
+ spec.description = %q{Downloading newest radio programs on the web. Supported radio stations are hibiki, onsen, niconico, freshlive, himalaya and asobi store.}
11
11
  spec.summary = %q{Downloading newest radio programs on the web.}
12
12
  spec.homepage = "https://github.com/wasamas/rget"
13
13
  spec.license = "GPL"
data/rget.yaml CHANGED
@@ -52,3 +52,7 @@ programs:
52
52
  desc: ラジオ「たねさんはるさんとはなそ。(意志)」
53
53
  url: http://m.himalaya.fm/jp/podcast/190452
54
54
  label: たねさんはるさんとはなそ。(意志)
55
+ shiny_radio:
56
+ desc: ラジオ「アイドルマスター シャイニーカラーズ はばたきラジオステーション」
57
+ url: https://asobistore.jp/special/List?ip_seq%5B%5D=1&ip_seq%5B%5D=14&tag_seq%5B%5D=1
58
+ 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: 4.6.1
4
+ version: 4.7.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: 2018-06-19 00:00:00.000000000 Z
11
+ date: 2018-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description: Downloading newest radio programs on the web. Supported radio stations
140
- are hibiki, onsen, niconico, freshlive and himalaya.
140
+ are hibiki, onsen, niconico, freshlive, himalaya and asobi store.
141
141
  email:
142
142
  - t@tdtds.jp
143
143
  executables:
@@ -157,6 +157,7 @@ files:
157
157
  - bin/nicodl
158
158
  - bin/rget
159
159
  - bin/ulizadl
160
+ - lib/asobistore.rb
160
161
  - lib/dropbox.rb
161
162
  - lib/freshlive.rb
162
163
  - lib/hibiki.rb