mirror of https://code.videolan.org/videolan/vlc
fix dailymotion parser, choosing VP6 as the default of the multiple streams available
note that a prebuilt table of preferred codecs, or even user interaction would be better
This commit is contained in:
parent
f03c892c22
commit
f79fb4ec10
|
@ -34,24 +34,36 @@ function parse()
|
||||||
do
|
do
|
||||||
line = vlc.readline()
|
line = vlc.readline()
|
||||||
if not line then break end
|
if not line then break end
|
||||||
if string.match( line, "param name=\"flashvars\" value=\".*url=http" )
|
if string.match( line, "param name=\"flashvars\" value=\".*video=" )
|
||||||
then
|
then
|
||||||
path = vlc.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*url=(http[^&]*).*$", "%1" ) )
|
arturl = vlc.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*preview=([^&]*).*$", "%1" ) )
|
||||||
|
videos = vlc.decode_uri( string.gsub( line, "^.*param name=\"flashvars\" value=\".*video=([^&]*).*$", "%1" ) )
|
||||||
|
--[[ we get a list of different streams available, at various codecs
|
||||||
|
and resolutions:
|
||||||
|
/A@@spark||/B@@spark-mini||/C@@vp6-hd||/D@@vp6||/E@@h264
|
||||||
|
Not everybody can decode HD, not everybody has a 80x60 screen,
|
||||||
|
H264/MP4 is buggy , so i choose VP6
|
||||||
|
|
||||||
|
Ideally, VLC would propose the different streams available, codecs
|
||||||
|
and resolutions (the resolutions are part of the URL)
|
||||||
|
]]
|
||||||
|
for n in string.gmatch(videos, "[^|]+") do
|
||||||
|
i = string.find(n, "@@")
|
||||||
|
if i then
|
||||||
|
video = string.sub( n, 0, i - 1)
|
||||||
|
codec = string.sub( n, i + 2 )
|
||||||
|
if video and codec and string.match(codec, "vp6") then
|
||||||
|
path = "http://dailymotion.com" .. video
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--[[ if string.match( line, "<title>" )
|
|
||||||
then
|
|
||||||
title = vlc.decode_uri( string.gsub( line, "^.*<title>([^<]*).*$", "%1" ) )
|
|
||||||
end ]]
|
|
||||||
if string.match( line, "<meta name=\"description\"" )
|
if string.match( line, "<meta name=\"description\"" )
|
||||||
then
|
then
|
||||||
name = vlc.resolve_xml_special_chars( string.gsub( line, "^.*name=\"description\" content=\"%w+ (.*) %w+ %w+ %w+ %w+ Videos\..*$", "%1" ) )
|
name = vlc.resolve_xml_special_chars( string.gsub( line, "^.*name=\"description\" content=\"%w+ (.*) %w+ %w+ %w+ %w+ Videos\..*$", "%1" ) )
|
||||||
description = vlc.resolve_xml_special_chars( string.gsub( line, "^.*name=\"description\" content=\"%w+ .* %w+ %w+ %w+ %w+ Videos\. ([^\"]*)\".*$", "%1" ) )
|
description = vlc.resolve_xml_special_chars( string.gsub( line, "^.*name=\"description\" content=\"%w+ .* %w+ %w+ %w+ %w+ Videos\. ([^\"]*)\".*$", "%1" ) )
|
||||||
end
|
end
|
||||||
if string.match( line, "\\\"videoPreview\\\"" )
|
|
||||||
then
|
|
||||||
arturl = string.gsub( line, "^.*\\\"videoPreview\\\":\\\"([^\"]*).*$", "%1" )
|
|
||||||
arturl = string.gsub( arturl, "\\", "" )
|
|
||||||
end
|
|
||||||
if path and name and description and arturl then break end
|
if path and name and description and arturl then break end
|
||||||
end
|
end
|
||||||
return { { path = path; name = name; description = description; url = vlc.path; arturl = arturl } }
|
return { { path = path; name = name; description = description; url = vlc.path; arturl = arturl } }
|
||||||
|
|
Loading…
Reference in New Issue