Class: Jcba

Inherits:
ListenRadio show all
Defined in:
lib/rbtune/jcba.rb

Instance Attribute Summary

Attributes inherited from Radio

#area_en, #area_id, #area_ja, #ext, #outdir

Instance Method Summary collapse

Methods inherited from ListenRadio

#initialize

Methods inherited from Radio

#agent, bands, #channel_to_uri, channels, #close, #convert, #convert_ffmpeg, #create_player, #datetime, db, #fetch_stations, find, inherited, #initialize, #login, #make_recfile, #make_tmpfile, match, #open, #out_ext, #play, #record, search, stations, #tune

Constructor Details

This class inherits a constructor from ListenRadio

Instance Method Details

#parse_stations(body) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rbtune/jcba.rb', line 15

def parse_stations(body)
	radioboxes = body / 'div.areaList ul li'
	stations = radioboxes.map do |station|
		h3      = station.at 'h3'
		rplayer = station.at 'div.rplayer'
		text    = station.at 'div.text'

		id   = rplayer['id']
		uri  = "http://musicbird-hls.leanstream.co/musicbird/#{id}.stream/playlist.m3u8"
		name = h3.text.sub(%r( / .*), '')
		desc = text.text
		# puts "(#{h3.text}) (#{rplayer['id']}) (#{text.text})"
		Station.new(id, uri, name: name, description: desc)
	end
end

#stations_uriObject



10
11
12
# File 'lib/rbtune/jcba.rb', line 10

def stations_uri
	'https://www.jcbasimul.com'
end