diff options
Diffstat (limited to 'module/plugins')
| -rw-r--r-- | module/plugins/hooks/CaptchaTrader.py | 2 | ||||
| -rw-r--r-- | module/plugins/hoster/YoutubeCom.py | 20 | 
2 files changed, 10 insertions, 12 deletions
| diff --git a/module/plugins/hooks/CaptchaTrader.py b/module/plugins/hooks/CaptchaTrader.py index 88b928a50..00f517751 100644 --- a/module/plugins/hooks/CaptchaTrader.py +++ b/module/plugins/hooks/CaptchaTrader.py @@ -66,7 +66,7 @@ class CaptchaTrader(Hook):          if response[0] < 0:              raise CaptchaTraderException(response[1])          else: -            self.log.debug("CaptchaTrader: %s credits left" % response[1]) +            self.logInfo(_("%s credits left") % response[1])              return response[1]      def submit(self, captcha, captchaType="file", match=None): diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index b94340fe3..8eab8f384 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -10,13 +10,14 @@ class YoutubeCom(Hoster):      __type__ = "hoster"      __pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*"      __version__ = "0.2" -    __config__ = [("quality", "sd,hd,fullhd", "Quality Setting", "hd")] +    __config__ = [("quality", "sd;hd;fullhd", "Quality Setting", "hd"), +                   ("fmt", "int", "FMT Number 0-38", 0)]      __description__ = """Youtube.com Video Download Hoster"""      __author_name__ = ("spoob")      __author_mail__ = ("spoob@pyload.org")      def process(self, pyfile): -        html = self.load(pyfile.url, utf8=True) +        html = self.load(pyfile.url, decode=True)          if re.search(r"(.*eine fehlerhafte Video-ID\.)", html) is not None:              self.offline() @@ -46,6 +47,9 @@ class YoutubeCom(Hoster):          elif self.getConf("quality") == "fullhd" and hd_available:              desired_fmt = 37 +        if self.getConfig("fmt"): +            desired_fmt = self.getConf("fmt") +          fmt_pattern = 'fmt_url_map=(.+?)&'          fmt_url_map = re.search(fmt_pattern, html).group(1)          links = urllib.unquote(fmt_url_map).split(",") @@ -62,13 +66,7 @@ class YoutubeCom(Hoster):          self.logDebug("Found links: %s" % fmt_dict) -        file_url = "" -        file_fmt = 0 - -        for fmt in sorted(fmt_dict.keys()): -            if abs(fmt - desired_fmt) <= abs(file_fmt - desired_fmt): -                file_url = fmt_dict[fmt] -                file_fmt = fmt +        fmt = reduce(lambda x,y: x if abs(x-desired_fmt) <= abs(y-desired_fmt) else y, fmt_dict.keys()) -        self.logDebug("Choosed fmt: %s" % file_fmt) -        self.download(file_url) +        self.logDebug("Choose fmt: %s" % fmt) +        self.download(fmt_dict[fmt]) | 
