Sha256: 2bcf6dbcf0dea37d0e4f5b1ac65921135d4738bf8fc5c67077e2aec3dc458a44

Contents?: true

Size: 707 Bytes

Versions: 4

Compression:

Stored size: 707 Bytes

Contents

# encoding: utf-8

require 'hls'
require 'nokogiri'
require 'json'

class Onsen < HLS
	def initialize(params, options)
		super
		@cover = "//*[@class='newest-content--left']//img[1]/@src" unless @cover
	end

	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

	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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rget-4.12.0 lib/onsen.rb
rget-4.11.0 lib/onsen.rb
rget-4.10.0 lib/onsen.rb
rget-4.9.3 lib/onsen.rb