[vlc-devel] [PATCH] vimeo playback now hides user agent automatically

Rafaël Carré funman at videolan.org
Sat Mar 2 15:00:16 CET 2013


Hello,

Le 01/03/2013 21:09, Stephen Parry a écrit :
> 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.
> ---
>  share/lua/playlist/vimeo.lua |  146 ++++++++++++++++++++++--------------------
>  1 file changed, 77 insertions(+), 69 deletions(-)
> 
> diff --git a/share/lua/playlist/vimeo.lua b/share/lua/playlist/vimeo.lua

> +    agent = vlc.var.inherit(nil,"http-user-agent")
> +    vlc.msg.dbg("Agent="..agent)
> +    if string.match( string.lower(agent), ".*vlc.*" ) then
> +        vlc.msg.dbg("Wrong agent...")
> +        return { { path = vlc.access .. "://" .. vlc.path; options = {":http-user-agent=Mozilla/5.0" } } }
> +    else

Is it possible to remove the else?

That would remove one level of indentation and make the patch more readable.

if foo
  ..
  return
end
# !foo is assumed




More information about the vlc-devel mailing list