[vlc-commits] liveleak.lua: fix title metadata parsing

Pierre Ynard git at videolan.org
Sat Apr 3 13:50:28 UTC 2021


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Apr  3 15:40:35 2021 +0200| [e02e408c34bb5569fd1e139d10b696f3c03fa6c6] | committer: Pierre Ynard

liveleak.lua: fix title metadata parsing

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e02e408c34bb5569fd1e139d10b696f3c03fa6c6
---

 share/lua/playlist/liveleak.lua | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/share/lua/playlist/liveleak.lua b/share/lua/playlist/liveleak.lua
index 890d493c92..39ee92e98e 100644
--- a/share/lua/playlist/liveleak.lua
+++ b/share/lua/playlist/liveleak.lua
@@ -1,7 +1,7 @@
 --[[
  $Id$
 
- Copyright © 2012, 2017 VideoLAN and AUTHORS
+ Copyright © 2012, 2017, 2021 VideoLAN and AUTHORS
 
  Authors: Ludovic Fauvet <etix at videolan.org>
           Pierre Ynard
@@ -29,12 +29,6 @@ function probe()
            )
 end
 
--- Util function
-function find( haystack, needle )
-    local _,_,r = string.find( haystack, needle )
-    return r
-end
-
 -- Parse function.
 function parse()
     local p = {}
@@ -47,9 +41,16 @@ function parse()
         if not line then break end
 
         -- Try to find the title
-        if string.match( line, '<span class="section_title"' ) then
-            title = find( line, '<span class="section_title"[^>]*>(.-)<' )
-            title = vlc.strings.resolve_xml_special_chars( title )
+        if not title then
+            title = string.match( line, "shareTitle: *'(.-[^\\])'" )
+            if title then
+                if string.match( title, "^'" ) then
+                    title = nil
+                else
+                    -- FIXME: do this properly (see #24958)
+                    title = string.gsub( title, "\\'", "'" )
+                end
+            end
         end
 
         -- Try to find the art



More information about the vlc-commits mailing list