[FFmpeg-devel] [PATCH] http: Tell translate.google.com that we are firefox

Stefano Sabatini stefasab at gmail.com
Wed Apr 3 21:22:14 CEST 2013


On date Tuesday 2013-04-02 23:12:44 -0400, compn encoded:
> On Wed, 3 Apr 2013 04:18:10 +0200, Reimar Döffinger wrote:
> >On 3 Apr 2013, at 01:06, Stefano Sabatini <stefasab at gmail.com> wrote:
> >> On date Wednesday 2013-04-03 00:59:38 +0200, Michael Niedermayer encoded:
> >>> Fixes Ticket2265
> >>> 
> >>> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> >>> ---
> >>> libavformat/http.c |    4 ++++
> >>> 1 file changed, 4 insertions(+)
> >>> 
> >>> diff --git a/libavformat/http.c b/libavformat/http.c
> >>> index 1e3cff7..d048688 100644
> >>> --- a/libavformat/http.c
> >>> +++ b/libavformat/http.c
> >>> @@ -537,6 +537,10 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
> >>>     proxyauthstr = ff_http_auth_create_response(&s->proxy_auth_state, proxyauth,
> >>>                                                 local_path, method);
> >>> 
> >>> +    //needed by: "http://translate.google.com/translate_tts?tl=fr&q=l%E8vres"
> >>> +    if(!strcmp("translate.google.com", hoststr) && !s->user_agent)
> >>> +        s->user_agent = av_strdup("Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:15.0) Gecko/20100101 Firefox/15.0.1");
> >>> +
> >> 
> >> I'm strongly against this, especially since there is no explanation of
> >> why this happens, and don't think that adding an hack for each website
> >> on the Internet having weird requirements is a good idea.
> >
> >I don't like it either, but why seems clear to me: there is some user-agent based filtering going on, possibly to stop bots etc. from creating load on the TTS server.
> 
> mplayer has custom user agent support, sometimes for individual sites to
> mimic other media players. some are listed in our example.conf:
> 
> # Pretend to be Window Media Player.
> # Fixes playback when playlist and media file use the same URL.
> #user-agent=NSPlayer/4.1.0.3856
> 
> # Pretend to be Quicktime
> # Fixes playback for apple.com/trailers redirects
> #user-agent="QuickTime"
> 
> # Pretend to be Realplayer SP
> # Fixes playback for some video streaming sites
> #user-agent=RMA/1.0
> 
> # Pretend to be Winamp
> # Fixes playback of some NSV streams
> #user-agent="Winamp NSV Player/5.12 (ultravox/2.0)"
> 
> 
> i'm for special casing websites, just because it makes ffmpeg work.
> users dont care about hacks, or reading bug reports or example command
> lines to get it working.

Ideally Google should be fixed, does someone know how to report the
problem (assuming they want to fix it)?

Also what is Google trying to achieve with that per-user-data filter
rule? (reducing workload on the server? really?)

As alternative we may load a file from the data dir where the
associations are listed (but yeah complicated if you want to override
it).

Finally we could implement an option for disabling heuristics, in case
the user doesn't want erratic behavior depending on the target URL.

If all this fails, I won't object this patch assuming there is no
volunteering maintainer for the HTTP code.

> it would be great if mplayer would automatically work for the above
> special cases^^. does it really matter if we forge a user agent to
> workaround a dumb server user-agent sniffer?
> 
> aside from possibly violating state/country laws about unauthorized use
> of computers and breaking website TOS.
> 

> the only problem i could see is if the website changed its sniffer
> requirements. the outcome would be the same as it is now, the stream
> would not work. at least in the meantime we could get it working.
> 
> i also wish ffmpeg (and mplayer) had youtube support so we can just do
> a ffmpeg http://youtubeurl and have it do all the required stuff to
> get/play the video automatically. like vlc has.

Indeed. Don't know if libquvi could provide a solution to this problem
as well.
 
> yeah its special casing a site, but when that site is responsible for
> a lot of the entire internet video streaming... its kind of important
> to have that feature.
-- 
FFmpeg = Frightening Freak Mastodontic Pure Elastic Goblin


More information about the ffmpeg-devel mailing list