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

Pierre Ynard git at videolan.org
Sat Apr 3 14:00:38 UTC 2021


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

liveleak.lua: fix title metadata parsing

(cherry picked from commit e02e408c34bb5569fd1e139d10b696f3c03fa6c6)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

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

 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