Check if parsing the player page before finding the player options
This commit is contained in:
parent
f340ef11af
commit
62565c10f2
|
@ -19,9 +19,16 @@ end
|
||||||
function parse()
|
function parse()
|
||||||
local pageSource = streams.readAll(vlc)
|
local pageSource = streams.readAll(vlc)
|
||||||
|
|
||||||
|
if vlc.path:match('player%.mediaklikk%.hu') then
|
||||||
|
log.dbg('Player loaded, finding player options json')
|
||||||
|
|
||||||
local playerOptionsJson = pageSource:match('pl.setup%( (%b{}) %);')
|
local playerOptionsJson = pageSource:match('pl.setup%( (%b{}) %);')
|
||||||
if playerOptionsJson then
|
if not playerOptionsJson then
|
||||||
log.dbg('Found player options json, finding playlist items of type hls')
|
log.warn('Cannot find player options json')
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
log.dbg('Finding playlist items of type hls')
|
||||||
|
|
||||||
local playerOptions = dkjson.decode(playerOptionsJson)
|
local playerOptions = dkjson.decode(playerOptionsJson)
|
||||||
local playlistItems = tables.filter(playerOptions.playlist, function(playlistItem)
|
local playlistItems = tables.filter(playerOptions.playlist, function(playlistItem)
|
||||||
|
@ -43,7 +50,7 @@ function parse()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
log.dbg('Cannot find player options json, finding embedded players');
|
log.dbg('Finding embedded players');
|
||||||
|
|
||||||
local playerSetupJsons = tables.toArray(pageSource:gmatch('mtva_player_manager%.player%(document%.getElementById%("player_%d+_%d+"%), (%b{})%);'));
|
local playerSetupJsons = tables.toArray(pageSource:gmatch('mtva_player_manager%.player%(document%.getElementById%("player_%d+_%d+"%), (%b{})%);'));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue