Commit 43db5ce6 authored by Pierre Ynard's avatar Pierre Ynard

youtube.lua: add comments

parent 1e811ab5
...@@ -47,6 +47,7 @@ function get_prefres() ...@@ -47,6 +47,7 @@ function get_prefres()
return prefres return prefres
end end
-- Pick the most suited format available
function get_fmt( fmt_list ) function get_fmt( fmt_list )
local prefres = get_prefres() local prefres = get_prefres()
if prefres < 0 then if prefres < 0 then
...@@ -66,6 +67,7 @@ function get_fmt( fmt_list ) ...@@ -66,6 +67,7 @@ function get_fmt( fmt_list )
return fmt return fmt
end end
-- Parse and pick our video URL
function pick_url( url_map, fmt ) function pick_url( url_map, fmt )
local path = nil local path = nil
-- Handle both orderings, as unfortunately both may appear -- Handle both orderings, as unfortunately both may appear
...@@ -173,6 +175,9 @@ function parse() ...@@ -173,6 +175,9 @@ function parse()
else else
format = "" format = ""
end end
-- Without "el=detailpage", /get_video_info fails for many
-- music videos with errors about copyrighted content being
-- "restricted from playback on certain sites"
path = "http://www.youtube.com/get_video_info?video_id="..video_id..format.."&el=detailpage" path = "http://www.youtube.com/get_video_info?video_id="..video_id..format.."&el=detailpage"
end end
...@@ -187,7 +192,7 @@ function parse() ...@@ -187,7 +192,7 @@ function parse()
return { { path = path; name = name; description = description; artist = artist; arturl = arturl } } return { { path = path; name = name; description = description; artist = artist; arturl = arturl } }
elseif string.match( vlc.path, "/get_video_info%?" ) then elseif string.match( vlc.path, "/get_video_info%?" ) then -- video info API
local line = vlc.readline() -- data is on one line only local line = vlc.readline() -- data is on one line only
local fmt = get_url_param( vlc.path, "fmt" ) local fmt = get_url_param( vlc.path, "fmt" )
......
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