Commit 48c98a0e authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Koreus: improve description parsing (support spoilers) and https

(cherry picked from commit 975a88e1e8e50608b5dfe1e34342d7dc06a4b6fe)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 6531f87c
...@@ -38,12 +38,19 @@ function parse() ...@@ -38,12 +38,19 @@ function parse()
_,_,name = string.find( line, "content=\"(.-)\"" ) _,_,name = string.find( line, "content=\"(.-)\"" )
name = vlc.strings.resolve_xml_special_chars( name ) name = vlc.strings.resolve_xml_special_chars( name )
end end
if string.match( line, "<meta name=\"description\"" ) then
if string.match( line, "<meta property=\"og:description\"" ) then
_,_,description = string.find( line, "content=\"(.-)\"" ) _,_,description = string.find( line, "content=\"(.-)\"" )
if (description ~= nil) then if (description ~= nil) then
description = vlc.strings.resolve_xml_special_chars( description ) description = vlc.strings.resolve_xml_special_chars( description )
end end
end end
if string.match( line, "<span id=\"spoil\" style=\"display:none\">" ) then
_,_,desc_spoil = string.find( line, "<span id=\"spoil\" style=\"display:none\">(.-)<\/span>" )
desc_spoil = vlc.strings.resolve_xml_special_chars( desc_spoil )
description = description .. "\n\r" .. desc_spoil
end
if string.match( line, "<meta name=\"author\"" ) then if string.match( line, "<meta name=\"author\"" ) then
_,_,artist = string.find( line, "content=\"(.-)\"" ) _,_,artist = string.find( line, "content=\"(.-)\"" )
artist = vlc.strings.resolve_xml_special_chars( artist ) artist = vlc.strings.resolve_xml_special_chars( artist )
...@@ -75,12 +82,16 @@ function parse() ...@@ -75,12 +82,16 @@ function parse()
end end
if path_url_hd then if path_url_hd then
if vlc.access == 'https' then path_url_hd = path_url_hd:gsub('http','https') end
return { { path = path_url_hd; name = name; description = description; artist = artist; arturl = arturl } } return { { path = path_url_hd; name = name; description = description; artist = artist; arturl = arturl } }
elseif path_url then elseif path_url then
if vlc.access == 'https' then path_url = path_url:gsub('http','https') end
return { { path = path_url; name = name; description = description; artist = artist; arturl = arturl } } return { { path = path_url; name = name; description = description; artist = artist; arturl = arturl } }
elseif path_url_webm then elseif path_url_webm then
if vlc.access == 'https' then path_url_webm = path_url_webm:gsub('http','https') end
return { { path = path_url_webm; name = name; description = description; artist = artist; arturl = arturl } } return { { path = path_url_webm; name = name; description = description; artist = artist; arturl = arturl } }
elseif path_url_flv then elseif path_url_flv then
if vlc.access == 'https' then path_url_flv = path_url_flv:gsub('http','https') end
return { { path = path_url_flv; name = name; description = description; artist = artist; arturl = arturl } } return { { path = path_url_flv; name = name; description = description; artist = artist; arturl = arturl } }
else else
return {} return {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment