diff options
author | Antti Ajanki <antti.ajanki@iki.fi> | 2013-08-07 11:39:29 +0300 |
---|---|---|
committer | Antti Ajanki <antti.ajanki@iki.fi> | 2013-08-07 12:59:26 +0300 |
commit | 3941ebd492cca1fb2037d675b68b089bbb1fa388 (patch) | |
tree | 62ee5b825228a1adcc03ca82dc65dfef0a07ff9b | |
parent | c8512910a23dfedbc307b4f5eb843f4dce65740f (diff) | |
download | vdr-plugin-webvideo-3941ebd492cca1fb2037d675b68b089bbb1fa388.tar.gz vdr-plugin-webvideo-3941ebd492cca1fb2037d675b68b089bbb1fa388.tar.bz2 |
Set user-agent to Mozilla/5.0 when downloading streams
-rw-r--r-- | src/webvicli/webvicli/client.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/webvicli/webvicli/client.py b/src/webvicli/webvicli/client.py index 737125a..0af470d 100644 --- a/src/webvicli/webvicli/client.py +++ b/src/webvicli/webvicli/client.py @@ -39,6 +39,7 @@ from StringIO import StringIO from . import menu VERSION = '0.5.0' +WEBVI_STREAM_USER_AGENT = "Mozilla/5.0" # Default options DEFAULT_PLAYERS = ['mplayer -cache-min 10 "%s"', @@ -105,6 +106,12 @@ def next_available_file_name(basename, ext): i += 1 return '%s-%d%s' % (basename, i, ext) + +class WebviURLopener(urllib.FancyURLopener): + version = WEBVI_STREAM_USER_AGENT +urllib._urlopener = WebviURLopener() + + class StringIOCallback(StringIO): def write_and_return_length(self, buf): self.write(buf) |