rget 4.8.4 → 4.9.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
  SHA256:
3
- metadata.gz: 03b7d1828386cb0e82ac5a74e638df84d09261e127ed70ab6d3d0b5ab8ab0e27
4
- data.tar.gz: 20ac0f562a4247470d0f805a3b6916c142089bc46ff93dc70ea83bf6a850e057
3
+ metadata.gz: eb55840b853e5fdb7a25521b025c3fb4cd18d164c8ad28c33896e113b1f2f5b2
4
+ data.tar.gz: 5ee1cde4d467a0cb7f641280bfbd663fba4f1d8eccca6c93a6946d61d8545128
5
5
  SHA512:
6
- metadata.gz: 1ac0660ba7e663e31410fc9c5efa10d7700ae39e44605bab3a7be9b1981708ed41ee7611f5cab987830766eef8bc3433da777dcf76a4c20b90cb30708e69e36d
7
- data.tar.gz: 04a08917dfbd660f2ba2e1be0df9d9ac8af7bd611d42795a6a278fcc9eedcd30d32cf36ab2f5e732e359eccdeda2b4aa29a5677aa1e885f61ae083b1543a6928
6
+ metadata.gz: 9329208c0d637d37b7c6e4f7dc7df19e8809b035e692b50571c6888ebab4d5e7548e5db110ad81c50991953ab7f36f0a6955c6bd3651e3e8a6607dd638925ae2
7
+ data.tar.gz: 2fd48e4acf50937d818e203cf47a9d9222a55707e20ca7ae23e40fcacd8d02640a886a28bfd8fbc3e5fd532ae18ef19f19b2d2e5adb9b72fe5e7f9b009c1760c
data/README.md CHANGED
@@ -7,7 +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
+ * Asobi Store
11
11
 
12
12
  If you want to save files as MP3, needs `ffmpeg` command.
13
13
  To download niconico video, also needs latest `youtube-dl` command (you can get it from `https://yt-dl.org/`), then specify niconico user ID and password to `~/.netrc` as:
@@ -5,8 +5,8 @@ require 'open-uri'
5
5
  require 'thread'
6
6
 
7
7
  if ARGV.size != 2
8
- $stderr.puts "download TS file decoded by Uliza style video streaming"
9
- $stderr.puts "ulizadl <playlist.m3u8> <output(.ts)>"
8
+ $stderr.puts "high speed video downloader of Http Live Streaming (HLS)"
9
+ $stderr.puts "hls-dl <playlist.m3u8> <output(.ts)>"
10
10
  exit 1
11
11
  end
12
12
 
@@ -21,7 +21,7 @@ begin
21
21
  agent.get(m3u8)
22
22
  body = agent.page.body
23
23
  rescue ArgumentError
24
- body = open(m3u8, &:read)
24
+ body = URI.open(m3u8, &:read)
25
25
  end
26
26
  tses = body.scan(/.*\.ts.*/)
27
27
  key_url = body.scan(/URI="(.*)"/).flatten.first
@@ -10,9 +10,9 @@ class AsobiStore < WebRadio
10
10
 
11
11
  def download
12
12
  player = find_player(@url)
13
- html = Nokogiri(open("https:#{player}").read)
13
+ html = Nokogiri(URI.open("https:#{player}").read)
14
14
  src_m3u8 = html.css('source').first.attr('src')
15
- m3u8 = "#{File.dirname(src_m3u8)}/#{open(src_m3u8).read.match(/^[^#].*/)[0]}"
15
+ m3u8 = "#{File.dirname(src_m3u8)}/#{URI.open(src_m3u8).read.match(/^[^#].*/)[0]}"
16
16
 
17
17
  serial = html.title.scan(/#(\d+)/).flatten.first.to_i
18
18
  @cover = "https:#{html.css('audio,video').first.attr('poster')}" unless @cover
@@ -24,7 +24,7 @@ class AsobiStore < WebRadio
24
24
  agent.get(m3u8)
25
25
  body = agent.page.body
26
26
  rescue ArgumentError
27
- body = open(m3u8, &:read)
27
+ body = URI.open(m3u8, &:read)
28
28
  end
29
29
  tses = body.scan(/.*\.ts.*/)
30
30
  key_url = body.scan(/URI="(.*)"/).flatten.first
@@ -52,10 +52,10 @@ class AsobiStore < WebRadio
52
52
 
53
53
  private
54
54
  def find_player(url)
55
- programs = Nokogiri(open(url).read)
55
+ programs = Nokogiri(URI.open(url).read)
56
56
  programs.css('.list-main-product a.wrap').each do |program|
57
57
  begin
58
- return Nokogiri(open("https://asobistore.jp#{program.attr('href')}").read).css('iframe').last.attr('src')
58
+ return Nokogiri(URI.open("https://asobistore.jp#{program.attr('href')}").read).css('iframe').last.attr('src')
59
59
  rescue # access denied because only access by premium members
60
60
  next
61
61
  end
@@ -10,7 +10,7 @@ class FreshLive < WebRadio
10
10
  archive = URI(File.join(@url + '/programs/archive'))
11
11
  end
12
12
 
13
- each_programs(Nokogiri(open(archive).read)) do |meta|
13
+ each_programs(Nokogiri(URI.open(archive).read)) do |meta|
14
14
  begin
15
15
  serial = meta['data']['title'].scan(/\d+$/).first.to_i
16
16
  src = "#{@label}##{'%02d' % serial}.ts"
@@ -24,7 +24,7 @@ class FreshLive < WebRadio
24
24
  print "getting #{src}..."
25
25
  ts_list(meta['data']['archiveStreamUrl']).each_with_index do |u, i|
26
26
  print '.' if i % 50 == 0
27
- w.write(open(u, 'rb').read)
27
+ w.write(URI.open(u, 'rb').read)
28
28
  end
29
29
  end
30
30
  end
@@ -62,7 +62,7 @@ class FreshLive < WebRadio
62
62
  }
63
63
  else
64
64
  tag = Pathname(u.path).basename.to_s
65
- meta = JSON.parse(Nokogiri(open(@url, &:read)).css('script').first)
65
+ meta = JSON.parse(Nokogiri(URI.open(@url, &:read)).css('script').first)
66
66
  return {
67
67
  tag => {
68
68
  'desc' => meta['name'],
@@ -78,13 +78,13 @@ private
78
78
  x = "//section[descendant::h1[contains(text(),'アーカイブ')]]//*[contains(@class,'ProgramTitle')]/a/@href"
79
79
  html.xpath(x).each do |href|
80
80
  id = Pathname(href.value).basename.to_s
81
- yield JSON.parse(open("https://freshlive.tv/proxy/Programs;id=#{id}", &:read))
81
+ yield JSON.parse(URI.open("https://freshlive.tv/proxy/Programs;id=#{id}", &:read))
82
82
  end
83
83
  end
84
84
 
85
85
  def ts_list(rate_m3u8)
86
- ts_m3u8 = open(rate_m3u8).read.each_line.grep_v(/^#/)[1].chomp
87
- open(URI(rate_m3u8) + ts_m3u8).read.each_line.grep_v(/^#/).map{|u|URI(rate_m3u8) + u.chomp}
86
+ ts_m3u8 = URI.open(rate_m3u8).read.each_line.grep_v(/^#/)[1].chomp
87
+ URI.open(URI(rate_m3u8) + ts_m3u8).read.each_line.grep_v(/^#/).map{|u|URI(rate_m3u8) + u.chomp}
88
88
  end
89
89
 
90
90
  def to_mp3(src)
@@ -8,7 +8,7 @@ class Himalaya < WebRadio
8
8
  end
9
9
 
10
10
  def download
11
- html = open(@url).read
11
+ html = URI.open(@url).read
12
12
  json_str = html.scan(/__NEXT_DATA__ = (.*)/).flatten.first
13
13
  json = JSON.parse(json_str)
14
14
  tracks = json['props']['seo']['albumData']['data']['tracks']['list']
@@ -22,7 +22,7 @@ class Himalaya < WebRadio
22
22
  mp3_file = "#{@label}##{serial}.mp3"
23
23
  mp3nize(m4a_file, mp3_file) do
24
24
  open(m4a_file, 'wb:ASCII-8BIT') do |m4a|
25
- m4a.write(open(m4a_url).read)
25
+ m4a.write(URI.open(m4a_url).read)
26
26
  end
27
27
  end
28
28
  end
@@ -1,8 +1,8 @@
1
1
  require 'webradio'
2
2
 
3
- class Uliza < WebRadio
3
+ class HLS < WebRadio
4
4
  private
5
- def uliza_download(name, html, serial_pattern, m3u_pattern)
5
+ def hls_download(name, html, serial_pattern, m3u_pattern)
6
6
  serial = html.scan(serial_pattern).flatten.sort{|a,b| a.to_i <=> b.to_i}.last
7
7
  @m4a_file = "#{name}##{serial}.m4a"
8
8
  @mp3_file = @m4a_file.sub(/\.m4a$/, '.mp3')
@@ -11,18 +11,18 @@ private
11
11
  unless m3u_meta2
12
12
  raise WebRadio::DownloadError.new("recent radio program not found.")
13
13
  end
14
- m3u_meta1 = open(m3u_meta2, &:read)
14
+ m3u_meta1 = URI.open(m3u_meta2, &:read)
15
15
  m3u = m3u_meta1.scan(/^[^#].*/).first
16
16
  save_m4a(URI(m3u), @m4a_file)
17
17
  end
18
18
  end
19
19
 
20
20
  def get_m4a(uri_playlist)
21
- open(uri_playlist).each_line do |l|
21
+ URI.open(uri_playlist).each_line do |l|
22
22
  next if /^#/ =~ l
23
23
  l.chomp!
24
24
  print "."
25
- yield open(uri_playlist + l, 'r:ASCII-8BIT', &:read)
25
+ yield URI.open(uri_playlist + l, 'r:ASCII-8BIT', &:read)
26
26
  end
27
27
  end
28
28
 
@@ -74,11 +74,11 @@ private
74
74
  video_url = nil
75
75
  begin
76
76
  begin
77
- rss = RSS::Parser.parse(open(list_url).read)
77
+ rss = RSS::Parser.parse(URI.open(list_url).read)
78
78
  item = rss.items[offset]
79
79
  video_url = item.link
80
80
  rescue RSS::NotWellFormedError
81
- html = open(list_url, &:read)
81
+ html = URI.open(list_url, &:read)
82
82
  url = html.scan(%r|/watch/[\w]+|)[offset]
83
83
  raise WebRadio::DownloadError.new('video not found in this pege') unless url
84
84
  video_url = "http://www.nicovideo.jp#{url}"
@@ -93,7 +93,7 @@ private
93
93
  end
94
94
 
95
95
  def thumbinfo(video, elem = nil)
96
- xml = open("http://ext.nicovideo.jp/api/getthumbinfo/#{video.id}").read
96
+ xml = URI.open("http://ext.nicovideo.jp/api/getthumbinfo/#{video.id}").read
97
97
  if elem
98
98
  return xml.scan(%r|<#{elem}>(.*)</#{elem}>|m).flatten.first
99
99
  else
@@ -15,7 +15,7 @@ class Onsen < WebRadio
15
15
 
16
16
  def dump
17
17
  tag = Pathname(@url).basename.to_s.gsub(%r|[-/]|, '_')
18
- html = Nokogiri(open(@url, &:read))
18
+ html = Nokogiri(URI.open(@url, &:read))
19
19
  title = html.css('#outLineWrap h1').text
20
20
  return {
21
21
  tag => {
@@ -28,7 +28,7 @@ class Onsen < WebRadio
28
28
 
29
29
  private
30
30
  def onsen_download(name, program_id)
31
- html = Nokogiri(open('http://onsen.ag/', 'User-Agent' => 'iPhone', &:read))
31
+ html = Nokogiri(URI.open('http://onsen.ag/', 'User-Agent' => 'iPhone', &:read))
32
32
  begin
33
33
  serial = html.css("##{program_id}").text.scan(/#(\d+)/).flatten.first
34
34
  mp3_url = html.css('form[target=_self]').select {|form|
@@ -41,7 +41,7 @@ private
41
41
  mp3_file = "#{name}##{serial}.mp3"
42
42
  mp3nize(src_file, mp3_file, false) do
43
43
  open(src_file, 'wb:ASCII-8BIT') do |mp3|
44
- mp3.write open(mp3_url, 'rb:ASCII-8BIT', &:read)
44
+ mp3.write URI.open(mp3_url, 'rb:ASCII-8BIT', &:read)
45
45
  end
46
46
  end
47
47
  end
@@ -29,7 +29,7 @@ class Podcast
29
29
  end
30
30
  print "getting #{serial}..."
31
31
  open(file, 'wb:ASCII-8BIT') do |o|
32
- o.write(open(episode.enclosure.url, 'rb:ASCII-8BIT', &:read))
32
+ o.write(URI.open(episode.enclosure.url, 'rb:ASCII-8BIT', &:read))
33
33
  end
34
34
  puts "done."
35
35
  end
@@ -132,13 +132,13 @@ private
132
132
  end
133
133
 
134
134
  def cover_image_as_url
135
- open(@cover, 'rb', &:read)
135
+ URI.open(@cover, 'rb', &:read)
136
136
  end
137
137
 
138
138
  def cover_image_as_xpath
139
- html = Nokogiri(open(@url, &:read))
139
+ html = Nokogiri(URI.open(@url, &:read))
140
140
  image_url = (URI(@url) + (html.xpath(@cover)[0].text)).to_s
141
- open(image_url, 'r:ASCII-8BIT', &:read)
141
+ URI.open(image_url, 'r:ASCII-8BIT', &:read)
142
142
  end
143
143
 
144
144
  def exist?(dst)
@@ -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.8.4"
7
+ spec.version = "4.9.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, freshlive, himalaya and asobi store.}
data/rget.yaml CHANGED
@@ -1,5 +1,5 @@
1
1
  options:
2
- mp3nize: ffmpeg -i '$1' -vn -acodec copy '$2' || ffmpeg -i '$1' -vn -y -ab 64k '$2'
2
+ mp3nize: ffmpeg -i '$1' -vn -acodec copy '$2' || ffmpeg -i '$1' -vn -y -ab 128k '$2'
3
3
  programs:
4
4
  imas_cg:
5
5
  desc: デレラジ☆
@@ -15,44 +15,11 @@ programs:
15
15
  url: http://ch.nicovideo.jp/search/%E6%B4%B2%E5%B4%8E%E8%A5%BF?channel_id=ch2589908&mode=s&sort=f&order=d&type=video
16
16
  label: 洲崎西
17
17
  cover: https://pbs.twimg.com/profile_images/836214019849506818/kXSasy1Y.jpg
18
- takamori:
19
- desc: 高森重戦舎 (声優バラエティ専門「声フレ」チャンネル内)
20
- url: https://freshlive.tv/seifre
21
- label: 高森重戦舎
22
- bahamut:
23
- desc: ラジオ神撃のバハムート
24
- url: http://hibiki-radio.jp/description/bahamut
25
- label: バハムート
26
- ssc:
27
- desc: 春佳・彩花のSSちゃんねる
28
- url: http://ch.nicovideo.jp/search/SS%E3%81%A1%E3%82%83%E3%82%93%E3%81%AD%E3%82%8B?channel_id=ch2589908&mode=s&sort=f&order=d&type=video
29
- label: 春佳・彩花のSSちゃんねる
30
- remake:
31
- desc: りめいく!
32
- url: http://ch.nicovideo.jp/search/%E3%82%8A%E3%82%81%E3%81%84%E3%81%8F?channel_id=ch2589908&mode=s&sort=f&order=d&type=video
33
- label: りめいく!
34
- adlib:
35
- desc: あどりぶ
36
- url: http://ch.nicovideo.jp/search/%E3%81%82%E3%81%A9%E3%82%8A%E3%81%B6?channel_id=ch2589908&mode=s&sort=f&order=d&type=video
37
- label: あどりぶ
38
- trysail:
39
- desc: TrySailのTRYangle harmony
40
- url: http://ch.nicovideo.jp/search/TrySail?channel_id=ch2585696&mode=s&sort=f&order=d&type=video
41
- label: トラハモ
42
- banpresto:
43
- desc: アイドルマスターWebラジオ~バンプレストスペシャル~
44
- url: http://ch.nicovideo.jp/search/IDOLM@STER?channel_id=ch346&mode=s&sort=f&order=d&type=video
45
- label: バンプレスト
46
- rebuild:
47
- desc: Rebuild.fm
48
- url: http://feeds.rebuild.fm/rebuildfm
49
- label: rebuildfm
50
- podcast: true
51
- taneharu:
52
- desc: ラジオ「たねさんはるさんとはなそ。(意志)」
53
- url: http://m.himalaya.fm/jp/podcast/190452
54
- label: たねさんはるさんとはなそ。(意志)
55
18
  shiny_radio:
56
19
  desc: ラジオ「アイドルマスター シャイニーカラーズ はばたきラジオステーション」
57
20
  url: https://asobistore.jp/special/List?ip_seq%5B%5D=1&ip_seq%5B%5D=14&tag_seq%5B%5D=1
58
21
  label: シャニラジ
22
+ luminesan:
23
+ desc: ル美子さん
24
+ url: https://ch.nicovideo.jp/luminesan/video?rss=2.0
25
+ 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.8.4
4
+ version: 4.9.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: 2019-11-04 00:00:00.000000000 Z
11
+ date: 2019-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -156,8 +156,8 @@ email:
156
156
  - t@tdtds.jp
157
157
  executables:
158
158
  - add_mp3info
159
+ - hls-dl
159
160
  - rget
160
- - ulizadl
161
161
  extensions: []
162
162
  extra_rdoc_files: []
163
163
  files:
@@ -168,17 +168,17 @@ files:
168
168
  - README.md
169
169
  - Rakefile
170
170
  - bin/add_mp3info
171
+ - bin/hls-dl
171
172
  - bin/rget
172
- - bin/ulizadl
173
173
  - lib/asobistore.rb
174
174
  - lib/dropbox.rb
175
175
  - lib/freshlive.rb
176
176
  - lib/hibiki.rb
177
177
  - lib/himalaya.rb
178
+ - lib/hls.rb
178
179
  - lib/nicovideo.rb
179
180
  - lib/onsen.rb
180
181
  - lib/podcast.rb
181
- - lib/uliza.rb
182
182
  - lib/webradio.rb
183
183
  - rget.gemspec
184
184
  - rget.yaml