class Onsen
Public Class Methods
new(params, options)
click to toggle source
Calls superclass method
WebRadio::new
# File lib/onsen.rb, line 8 def initialize(params, options) super @cover = "//*[@class='newest-content--left']//img[1]/@src" unless @cover end
Public Instance Methods
download()
click to toggle source
# File lib/onsen.rb, line 13 def download html = URI.open(@url, &:read) serial = Nokogiri(html).css('.play-video-info td')[0].text.scan(/\d+/)[0].to_i m3u8 = JSON.parse(html.scan(%r|streaming_url:("https:.*?.m3u8")|).flatten.sort.last) hls_download(@label, serial, m3u8) end
dump()
click to toggle source
# File lib/onsen.rb, line 20 def dump tag = Pathname(@url).basename.to_s.gsub(%r|[-/]|, '_') html = Nokogiri(URI.open(@url, &:read)) title = html.css('h3')[0].text return { tag => { 'desc' => title, 'url' => @url, 'label' => tag } } end