[vlc-commits] vimeo playback now hides user agent automatically

Stephen Parry git at videolan.org
Sun Mar 10 17:57:40 CET 2013


vlc | branch: master | Stephen Parry <sgparry at mainscreen.com> | Wed Mar  6 19:36:07 2013 +0000| [64a112182c9fd0eb1e46a9ba3d05f98b84df5237] | committer: Jean-Baptiste Kempf

vimeo playback now hides user agent automatically

Vimeo injects garbage into pages fetched by any user agent recognisable as
being VLC. Amended parse routine to check the current user agent; if the user
agent is set to VLC then parse returns a replacement playlist entry with the
same url but with an option setting the user agent to something that vimeo will
not trash.
The main playlist parsing loop then re-opens the stream with the correct agent
and calls vimeo.lua a second time; the stream is then parsed as before to get
the actual shortlived video url.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 share/lua/playlist/vimeo.lua |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/share/lua/playlist/vimeo.lua b/share/lua/playlist/vimeo.lua
index 1200e44..3134c19 100644
--- a/share/lua/playlist/vimeo.lua
+++ b/share/lua/playlist/vimeo.lua
@@ -42,6 +42,13 @@ end
 
 -- Parse function.
 function parse()
+    agent = vlc.var.inherit(nil,"http-user-agent")
+
+    if string.match( string.lower(agent), ".*vlc.*" ) then
+        vlc.msg.dbg("Wrong agent, adapting...")
+        return { { path = vlc.access .. "://" .. vlc.path; options = {":http-user-agent=Mozilla/5.0" } } }
+    end
+
     _,_,id = string.find( vlc.path, "vimeo.com/([0-9]*)")
     prefres = get_prefres()
     ishd = false



More information about the vlc-commits mailing list