rget 4.12.0 → 4.13.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: 313f0120701854057599c157f85971584cd70eed1dd45f6d8cc5ea1444cc714c
4
- data.tar.gz: 0f998f200f67b6a28186d3070b4b3f03e50b76d14e9c6def56a39afbdfda7a52
3
+ metadata.gz: 680138673b4a74e24fc3114cfefd7e4d7a1f4f56fe37ca70b7848c0256b95d63
4
+ data.tar.gz: fe7fdd1168af355285b5ec7ab4c9741f1acdd4fc496ea3a2bc9e59b5869f7011
5
5
  SHA512:
6
- metadata.gz: 8ce23bc480247bcf370528ac3f08191846516d5746f0a075862f21eb7e863caf2b6e89ecb297766018b248e8ddcb76b0ce477cd98ec5e58939a15f38da27930d
7
- data.tar.gz: 7cdfbc35c482db64f26899523d0338d69ca5faa82b70b84f187d4824766c97e2dc86f06d89565c9f4d54586a8449453a9aa3384cad17465a1446e251f8c19e28
6
+ metadata.gz: 394aac18d5099e78ef52c99896a132fdc805edc8670fa7e980e074ffd8ecd7fd02cf6ae423c059852c43253ab585b82d720d1400602c127a6dbd46ac80f3474e
7
+ data.tar.gz: d01d41849aa9e3ac8cef2e3e523b62445116bffe09952d7f91909a82c2e1b7d47de58429d537eb423a35c563ebe84ce29eecbdd42ed26c07629b0ee2a346fc88
@@ -1,4 +1,4 @@
1
- FROM ruby:2
1
+ FROM ruby:3
2
2
  ENV USER vscode
3
3
  LABEL maintainer "@tdtds <t@tdtds.jp>"
4
4
  RUN apt-get -y update && apt-get -y install ffmpeg && \
data/lib/hls.rb CHANGED
@@ -3,13 +3,14 @@ require 'open3'
3
3
 
4
4
  class HLS < WebRadio
5
5
  private
6
- def hls_download(name, serial, m3u_meta)
6
+ def hls_download(name, serial, m3u_meta, headers = {})
7
7
  mp4_file = "#{name}##{serial}.mp4"
8
8
  mp3_file = "#{name}##{serial}.mp3"
9
- m3u = URI.open(m3u_meta, &:read).scan(/^[^#].*/).first
9
+ m3u = URI.open(m3u_meta, headers, &:read).scan(/^[^#].*/).first
10
10
  m3u = Pathname(m3u_meta).dirname.join(m3u) if Pathname(m3u).relative?
11
+ ffmpeg_headers = headers.empty? ? '' : "-headers '" + headers.map{|k, v| "#{k}: #{v}"}.join("\r\n") + "'"
11
12
  mp3nize(mp4_file, mp3_file) do
12
- result = Open3.capture3(%Q[ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto -i "#{m3u}" "#{mp4_file}"])
13
+ result = Open3.capture3(%Q[ffmpeg -loglevel error -protocol_whitelist file,http,https,tcp,tls,crypto #{ffmpeg_headers} -i "#{m3u}" "#{mp4_file}"])
13
14
  unless result[2].to_i == 0
14
15
  raise WebRadio::DownloadError.new("failed download the radio program (#{@label}).")
15
16
  end
data/lib/onsen.rb CHANGED
@@ -5,21 +5,25 @@ require 'nokogiri'
5
5
  require 'json'
6
6
 
7
7
  class Onsen < HLS
8
+ HEADERS = {
9
+ "Referer" => 'https://www.onsen.ag/'
10
+ }
11
+
8
12
  def initialize(params, options)
9
13
  super
10
14
  @cover = "//*[@class='newest-content--left']//img[1]/@src" unless @cover
11
15
  end
12
16
 
13
17
  def download
14
- html = URI.open(@url, &:read)
18
+ html = URI.open(@url, HEADERS, &:read)
15
19
  serial = Nokogiri(html).css('.play-video-info td')[0].text.scan(/\d+/)[0].to_i
16
20
  m3u8 = JSON.parse(html.scan(%r|streaming_url:("https:.*?.m3u8")|).flatten.sort.last)
17
- hls_download(@label, serial, m3u8)
21
+ hls_download(@label, serial, m3u8, HEADERS)
18
22
  end
19
23
 
20
24
  def dump
21
25
  tag = Pathname(@url).basename.to_s.gsub(%r|[-/]|, '_')
22
- html = Nokogiri(URI.open(@url, &:read))
26
+ html = Nokogiri(URI.open(@url, HEADERS, &:read))
23
27
  title = html.css('h3')[0].text
24
28
  return {
25
29
  tag => {
data/lib/youtube.rb CHANGED
@@ -61,7 +61,7 @@ class YoutubePlaylist < Youtube
61
61
  @cover = item['thumbnail']['thumbnails'].last['url']
62
62
  title = item['title']['runs'][0]['text']
63
63
  serial = title.scan(/\d+/).first.to_i
64
- url = "https://www.youtube.com#{item["navigationEndpoint"]["commandMetadata"]["webCommandMetadata"]["url"]}"
64
+ url = "https://www.youtube.com/watch?v=#{item["videoId"]}"
65
65
 
66
66
  mp4_file = serial_file title, @label, serial, 'mp4'
67
67
  mp3_file = serial_file title, @label, serial, 'mp3'
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.12.0"
7
+ spec.version = "4.13.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, himalaya, asobi store, stand.fm and youtube.}
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency "pit"
24
24
  spec.add_runtime_dependency "dropbox_api"
25
25
  spec.add_runtime_dependency "mp3info"
26
+ spec.add_runtime_dependency "rss"
26
27
 
27
28
  spec.add_development_dependency "bundler"
28
29
  spec.add_development_dependency "rake"
data/rget.yaml CHANGED
@@ -9,7 +9,6 @@ programs:
9
9
  desc: ラジオ「松井恵理子のにじらじっ!」
10
10
  url: http://www.onsen.ag/program/matsui/
11
11
  label: 松井恵理子のにじらじ
12
- cover: //*[@id='newProgramWrap']//img[1]/@src
13
12
  suzakinishi:
14
13
  desc: 洲崎西
15
14
  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
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.12.0
4
+ version: 4.13.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: 2021-01-17 00:00:00.000000000 Z
11
+ date: 2021-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rss
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -204,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
218
  - !ruby/object:Gem::Version
205
219
  version: '0'
206
220
  requirements: []
207
- rubygems_version: 3.0.8
221
+ rubygems_version: 3.2.32
208
222
  signing_key:
209
223
  specification_version: 4
210
224
  summary: Downloading newest radio programs on the web.