rget 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1036d1b31cf0c12651c08e002dcf385d11101233
4
- data.tar.gz: 92c4cd83fd3b35c15f255c28413661bc000e4f45
3
+ metadata.gz: 3240c75e0ffe2d6e4d37b30c28514a266bf6f97d
4
+ data.tar.gz: b85968891bcb72cc5ec692b4e9b0b8fc910cd918
5
5
  SHA512:
6
- metadata.gz: '09b0fd82e8aad1d1c545f6242b56134d80bd935f5e3408c502244730c66c1f8021525467e230ba0df0aa1376c68a0f07b0fc7cc804ce0e6eb13e02c5b8ebfbf5'
7
- data.tar.gz: 6ea0a06f15fe8679a8d333145cde5b4a7bc589b177dd2efc796bef22f7c2436eee08be1d830da2cd66565d787e7dff93126db9fc23e6e4fb64c317620837858c
6
+ metadata.gz: 1eabc5b2f5763a9b063a726fe19d9e41cffed3ee862a246ecd7cc26862e0e4e851ead8c473f461da823dc93402edf5e686d961f63976ef6a27089020850ec5af
7
+ data.tar.gz: 6c747681bde7723bc2538282f56bb2f57e14ec681e5df0fe788492249b7cddb2dc8b63a4133b3ed5d5a571f1eb1ef021684d71b67d00f2cfbbc673572a425054
data/lib/freshlive.rb ADDED
@@ -0,0 +1,48 @@
1
+ require 'webradio'
2
+ require 'nokogiri'
3
+ require 'json'
4
+
5
+ class FreshLive < WebRadio
6
+ def initialize(url, options)
7
+ super
8
+ @archive = URI(File.join(@url + '/archive'))
9
+ @doc = Nokogiri(open(@archive).read).root
10
+ end
11
+
12
+ def download(name)
13
+ meta = program_meta(program_id)
14
+ serial = meta['data']['title'].scan(/\d+$/).first.to_i
15
+ open("#{name}##{'%02d' % serial}.ts", 'wb') do |w|
16
+ ts_list(meta['data']['archiveStreamUrl']).each do |u|
17
+ w.write(open(u, 'rb').read)
18
+ end
19
+ end
20
+ end
21
+
22
+ def dump
23
+ tag = Pathname(@url).basename.to_s
24
+ meta = JSON.parse(@doc.css('script').first)
25
+
26
+ return {
27
+ tag => {
28
+ 'desc' => meta['name'],
29
+ 'url' => @url,
30
+ 'label' => tag
31
+ }
32
+ }
33
+ end
34
+
35
+ private
36
+ def program_id
37
+ Pathname(@doc.css('.ProgramTitle a').attr('href').value).basename.to_s
38
+ end
39
+
40
+ def program_meta(id)
41
+ JSON.parse(open("https://freshlive.tv/proxy/Programs;id=#{id}").read)
42
+ end
43
+
44
+ def ts_list(rate_m3u8)
45
+ ts_m3u8 = open(rate_m3u8).read.each_line.grep_v(/^#/)[1].chomp
46
+ open(URI(rate_m3u8) + ts_m3u8).read.each_line.grep_v(/^#/).map{|u|URI(rate_m3u8) + u.chomp}
47
+ end
48
+ end
data/lib/webradio.rb CHANGED
@@ -24,6 +24,9 @@ class WebRadio
24
24
  when %r[nicovideo\.jp]
25
25
  require 'nicovideo'
26
26
  Nicovideo.new(url, options)
27
+ when %r[^https://freshlive\.tv/]
28
+ require 'freshlive'
29
+ FreshLive.new(url, options)
27
30
  else
28
31
  raise 'unsupported url.'
29
32
  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.1.0"
7
+ spec.version = "3.2.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.}
data/rget.yaml CHANGED
@@ -47,3 +47,7 @@ programs:
47
47
  url: http://feeds.feedburner.com/amina1422
48
48
  label: よにこも
49
49
  podcast: true
50
+ takamori:
51
+ desc: 高森重戦舎 (声優バラエティ専門「声フレ」チャンネル内)
52
+ url: https://freshlive.tv/seifre
53
+ 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: 3.1.0
4
+ version: 3.2.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-05-08 00:00:00.000000000 Z
11
+ date: 2017-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -141,6 +141,7 @@ files:
141
141
  - bin/rget
142
142
  - lib/animate.rb
143
143
  - lib/dropbox.rb
144
+ - lib/freshlive.rb
144
145
  - lib/hibiki.rb
145
146
  - lib/nicovideo.rb
146
147
  - lib/onsen.rb