[vlc-commits] vocaroo.lua: update to new website changes

Pierre Ynard git at videolan.org
Fri Nov 22 03:16:04 CET 2019


vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri Nov 22 03:10:10 2019 +0100| [3774ec09eccfebd163303e9dcee47b49569a07d9] | committer: Pierre Ynard

vocaroo.lua: update to new website changes

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

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

 share/lua/playlist/vocaroo.lua | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/share/lua/playlist/vocaroo.lua b/share/lua/playlist/vocaroo.lua
index a4c632f7c0..3fc16a3acc 100644
--- a/share/lua/playlist/vocaroo.lua
+++ b/share/lua/playlist/vocaroo.lua
@@ -1,7 +1,7 @@
 --[[
  $Id$
 
- Copyright © 2016 the VideoLAN team
+ Copyright © 2016, 2019 the VideoLAN team
 
  Authors: Pierre Ynard
 
@@ -26,14 +26,28 @@ local fmt = "mp3"
 -- Probe function.
 function probe()
     return ( vlc.access == "http" or vlc.access == "https" )
-        and string.match( vlc.path, "^vocaroo%.com/i/" )
+        and ( string.match( vlc.path, "^old%.vocaroo%.com/i/" )
+            or string.match( vlc.path, "^beta%.vocaroo%.com/." )
+            or string.match( vlc.path, "^vocaroo%.com/." ) )
 end
 
 -- Parse function.
 function parse()
-    -- The HTML page contains no metadata and is not worth parsing
-    local id = string.match( vlc.path, "vocaroo%.com/i/([^?]*)" )
-    local path = vlc.access.."://vocaroo.com/media_command.php?media="..id.."&command=download_"..fmt
-    return { { path = path } }
+    -- At the moment, a new/beta platform coexists with the old one:
+    -- classic URLs for old media are redirected to the old platform,
+    -- while new media seems accessible only through the new platform.
+
+    -- With either platform, HTML pages contain no metadata and are not
+    -- worth parsing.
+
+    if string.match( vlc.path, "^old%.vocaroo%.com/" ) then -- Old platform
+        local id = string.match( vlc.path, "vocaroo%.com/i/([^?]*)" )
+        local path = vlc.access.."://old.vocaroo.com/media_command.php?media="..id.."&command=download_"..fmt
+        return { { path = path } }
+    else -- New/beta platform
+        local id = string.match( vlc.path, "vocaroo%.com/([^?]+)" )
+        local path = vlc.access.."://media.vocaroo.com/mp3/"..id
+        return { { path = path } }
+    end
 end
 



More information about the vlc-commits mailing list