[vlc-commits] youtube.lua: fix escaped characters issues in metadata
Pierre Ynard
git at videolan.org
Mon Jul 20 12:25:34 CEST 2020
vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Mon Jul 20 11:57:05 2020 +0200| [9d61f4ad2ed179d317b40eb6ca72d562d53fda08] | committer: Pierre Ynard
youtube.lua: fix escaped characters issues in metadata
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9d61f4ad2ed179d317b40eb6ca72d562d53fda08
---
share/lua/playlist/youtube.lua | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index f120a440bc..97515238ed 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -339,6 +339,10 @@ function parse()
if not artist then
artist = string.match(line, '\\"author\\":\\"(.-)\\"')
+ if artist then
+ -- FIXME: do this properly
+ artist = string.gsub( artist, "\\u0026", "&" )
+ end
end
-- JSON parameters, also formerly known as "swfConfig",
@@ -378,8 +382,8 @@ function parse()
local stream_map = string.match( line, '\\"formats\\":%[(.-)%]' )
if stream_map then
vlc.msg.dbg( "Found new-style parameters for youtube video stream, parsing..." )
- stream_map = string.gsub( stream_map, '\\(["\\/])', '%1' )
-- FIXME: do this properly
+ stream_map = string.gsub( stream_map, '\\(["\\/])', '%1' )
stream_map = string.gsub( stream_map, "\\u0026", "&" )
path = pick_stream( stream_map, js_url )
end
@@ -471,11 +475,15 @@ function parse()
if title then
title = string.gsub( title, "+", " " )
title = vlc.strings.decode_uri( title )
+ -- FIXME: do this properly
+ title = string.gsub( title, "\\u0026", "&" )
end
local artist = string.match( line, "%%22author%%22%%3A%%22(.-)%%22" )
if artist then
artist = string.gsub( artist, "+", " " )
artist = vlc.strings.decode_uri( artist )
+ -- FIXME: do this properly
+ artist = string.gsub( artist, "\\u0026", "&" )
end
local arturl = string.match( line, "%%22playerMicroformatRenderer%%22%%3A%%7B%%22thumbnail%%22%%3A%%7B%%22thumbnails%%22%%3A%%5B%%7B%%22url%%22%%3A%%22(.-)%%22" )
if arturl then
More information about the vlc-commits
mailing list