Commit 52cc3eab authored by Antoine Cellerier's avatar Antoine Cellerier

* youtube_homepage.lua: get the stream's duration.

parent 6323eda2
......@@ -8,11 +8,22 @@ function parse()
do
line = vlc.readline()
if not line then break end
for path, artist, name in string.gmatch( line, "href=\"(/watch%?v=[^\"]*)\" onclick=\"_hbLink%('([^']*)','Vid[^\']*'%);\">([^<]*)</a><br/>" )
for _path, _artist, _name in string.gmatch( line, "href=\"(/watch%?v=[^\"]*)\" onclick=\"_hbLink%('([^']*)','Vid[^\']*'%);\">([^<]*)</a><br/>" )
do
path = "http://www.youtube.com" .. path
name = vlc.resolve_xml_special_chars( name )
table.insert( p, { path = path; name = name; artist = artist } )
path = "http://www.youtube.com" .. _path
name = vlc.resolve_xml_special_chars( _name )
artist = _artist
end
for _min, _sec in string.gmatch( line, "<span class=\"runtime\">(%d*):(%d*)</span>" )
do
duration = 60 * _min + _sec
end
if path and name and artist and duration then
table.insert( p, { path = path; name = name; artist = artist; duration = duration } )
path = nil
name = nil
artist = nil
duration = nil
end
end
return p
......
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