rget 4.9.3 → 4.10.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 +4 -4
- data/.travis.yml +1 -1
- data/README.md +1 -1
- data/lib/standfm.rb +62 -0
- data/lib/webradio.rb +3 -0
- data/rget.gemspec +3 -3
- data/rget.yaml +4 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 002a0d55ff230dabdb3c046e67cf09a56f28aae9bbbb44c3bd7de3a4490cc770
|
4
|
+
data.tar.gz: 33f86195c750fb5cad0f133fe199fc8a94fe65f6a5bae2b0eb372eb7a34aed6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f144e5b3623c29342f278b22de551b3e535f8ce1a699d6454116718a4653bc4425b49ce3f4e8062cc98ca08e4940e6ce77462456161a99144008e9c5a36a7972
|
7
|
+
data.tar.gz: cf9a018da02a9651e554cff2237bebbe744aff02073799b10f02806fd55079e051fc123f2c79802694efc030682126b52eb2f128041d553468a8cdc6564a0e0b
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -5,9 +5,9 @@ Downloading newest radio programs on the web. Supported radio stations are:
|
|
5
5
|
* hibiki
|
6
6
|
* onsen
|
7
7
|
* niconico
|
8
|
-
* freshlive.tv
|
9
8
|
* himalaya.fm
|
10
9
|
* Asobi Store
|
10
|
+
* stand.fm
|
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:
|
data/lib/standfm.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'mechanize'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
class StandFm < WebRadio
|
7
|
+
def initialize(params, options)
|
8
|
+
super
|
9
|
+
@offset = 0
|
10
|
+
end
|
11
|
+
|
12
|
+
def download
|
13
|
+
uri = URI(@url)
|
14
|
+
html = Nokogiri(uri.open.read)
|
15
|
+
episode = uri + html.css('#root a[href^="/episodes/"]').map{|e|e.attr('href')}.uniq[@offset]
|
16
|
+
|
17
|
+
html = episode.open.read
|
18
|
+
json = JSON.parse(html.scan(%r[<script>window.__SERVER_STATE__=(.*)</script>]).flatten[0])
|
19
|
+
m4a = json['topics'].find{|k,v|v['episodeId'] == File.basename(episode.path)}.last['downloadUrl']
|
20
|
+
|
21
|
+
doc = Nokogiri(html)
|
22
|
+
serial = doc.title.scan(/#(\d+)/).flatten.first.to_i
|
23
|
+
@cover = doc.css('meta[property="og:image"]').attr('content').text unless @cover
|
24
|
+
m4a_file = "#{@label}##{serial}.m4a"
|
25
|
+
mp3_file = "#{@label}##{serial}.mp3"
|
26
|
+
|
27
|
+
mp3nize(m4a_file, mp3_file) do
|
28
|
+
open(m4a_file, 'wb:ASCII-8BIT') do |w|
|
29
|
+
w.write(URI(m4a).open.read)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def dump
|
35
|
+
uri = URI(@url)
|
36
|
+
tag = File.basename(uri.path)
|
37
|
+
html = Nokogiri(uri.open.read)
|
38
|
+
label, = html.css('title').text.split(/ \| /)
|
39
|
+
cover = html.css('meta[property="og:image"]').attr('content').text
|
40
|
+
return {
|
41
|
+
tag => {
|
42
|
+
'desc' => label,
|
43
|
+
'url' => @url,
|
44
|
+
'label' => label,
|
45
|
+
'cover' => cover
|
46
|
+
}
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def find_player(url)
|
52
|
+
programs = Nokogiri(URI.open(url).read)
|
53
|
+
programs.css('.list-main-product a.wrap').each do |program|
|
54
|
+
begin
|
55
|
+
return Nokogiri(URI.open("https://asobistore.jp#{program.attr('href')}").read).css('iframe').last.attr('src')
|
56
|
+
rescue # access denied because only access by premium members
|
57
|
+
next
|
58
|
+
end
|
59
|
+
end
|
60
|
+
raise StandardError.new('movie not found.')
|
61
|
+
end
|
62
|
+
end
|
data/lib/webradio.rb
CHANGED
@@ -29,6 +29,9 @@ class WebRadio
|
|
29
29
|
when %r[^https://asobistore\.jp/]
|
30
30
|
require 'asobistore'
|
31
31
|
AsobiStore.new(params, options)
|
32
|
+
when %r[^https://stand\.fm/channels/]
|
33
|
+
require 'standfm'
|
34
|
+
StandFm.new(params, options)
|
32
35
|
else
|
33
36
|
raise UnsupportError, "unsupported url: #{params['url']}"
|
34
37
|
end
|
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.
|
8
|
-
spec.authors = ["
|
7
|
+
spec.version = "4.10.0"
|
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,
|
10
|
+
spec.description = %q{Downloading newest radio programs on the web. Supported radio stations are hibiki, onsen, niconico, himalaya, asobi store and stand.fm.}
|
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
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.
|
4
|
+
version: 4.10.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: 2020-
|
11
|
+
date: 2020-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
description: Downloading newest radio programs on the web. Supported radio stations
|
154
|
-
are hibiki, onsen, niconico,
|
154
|
+
are hibiki, onsen, niconico, himalaya, asobi store and stand.fm.
|
155
155
|
email:
|
156
156
|
- t@tdtds.jp
|
157
157
|
executables:
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- lib/nicovideo.rb
|
182
182
|
- lib/onsen.rb
|
183
183
|
- lib/podcast.rb
|
184
|
+
- lib/standfm.rb
|
184
185
|
- lib/webradio.rb
|
185
186
|
- rget.gemspec
|
186
187
|
- rget.yaml
|