[vlc-commits] dailymotion.lua: update to website changes
Pierre Ynard
git at videolan.org
Sun Jan 27 00:29:20 CET 2019
vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Jan 27 00:26:31 2019 +0100| [af93e96577928df2a99dc555c60d86b49940608b] | committer: Pierre Ynard
dailymotion.lua: update to website changes
Video metadata is now available from a separate URL
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af93e96577928df2a99dc555c60d86b49940608b
---
share/lua/playlist/dailymotion.lua | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/share/lua/playlist/dailymotion.lua b/share/lua/playlist/dailymotion.lua
index 2806989989..c9f58ec0d0 100644
--- a/share/lua/playlist/dailymotion.lua
+++ b/share/lua/playlist/dailymotion.lua
@@ -1,10 +1,8 @@
--[[
- Translate Daily Motion video webpages URLs to the corresponding
- FLV URL.
+ Translate Dailymotion video webpages URLs to corresponding
+ video stream URLs.
- $Id$
-
- Copyright © 2007-2016 the VideoLAN team
+ Copyright © 2007-2019 the VideoLAN team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -47,10 +45,23 @@ function parse()
if string.match( line, "<meta property=\"og:image\"" ) then
arturl = string.match( line, "content=\"(.-)\"" )
end
+ end
+
+ local video_id = string.match( vlc.path, "^www%.dailymotion%.com/video/([^/?#]+)" )
+ if video_id then
+ local metadata = vlc.stream( vlc.access.."://www.dailymotion.com/player/metadata/video/"..video_id )
+ if metadata then
+ local line = metadata:readline() -- data is on one line only
- if string.match( line, "var __PLAYER_CONFIG__ = {" ) then
+ -- TODO: fetch "title" and resolve \u escape sequences
+ -- FIXME: use "screenname" instead and resolve \u escape sequences
artist = string.match( line, '"username":"([^"]+)"' )
+ local poster = string.match( line, '"poster_url":"([^"]+)"' )
+ if poster then
+ arturl = string.gsub( poster, "\\/", "/")
+ end
+
local streams = string.match( line, "\"qualities\":{(.-%])}" )
if streams then
local prefres = vlc.var.inherit(nil, "preferred-resolution")
@@ -81,7 +92,7 @@ function parse()
end
if not path then
- vlc.msg.err("Couldn't extract the video URL from dailymotion")
+ vlc.msg.err("Couldn't extract dailymotion video URL, please check for updates to this script")
return { }
end
More information about the vlc-commits
mailing list