From c1bad948e840243f4e1af1226d490043d3e01d78 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 25 Aug 2010 18:58:39 +0200 Subject: new icon, fixes --- module/plugins/hoster/UploadedTo.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'module/plugins/hoster/UploadedTo.py') diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index b6bd872f1..2b7f4e7e9 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -4,18 +4,23 @@ import re from time import time from module.plugins.Hoster import Hoster from module.network.Request import getURL +from module.plugins.Plugin import chunks import hashlib def getInfo(urls): - for url in urls: - match = re.compile(UploadedTo.__pattern__).search(url) - if match: - src = getURL("http://uploaded.to/api/file", get={"id": match.group(1).split("/")[0]}) - if src.find("404 Not Found") >= 0: - result.append((url, 0, 1, url)) - continue - lines = src.splitlines() - result.append((lines[0], int(lines[1]), 2, url)) + pattern = re.compile(UploadedTo.__pattern__) + for chunk in chunks(urls, 10): + result = [] + for url in chunk: + match = pattern.search(url) + if match: + src = getURL("http://uploaded.to/api/file", get={"id": match.group(1).split("/")[0]}) + if src.find("404 Not Found") >= 0: + result.append((url, 0, 1, url)) + continue + lines = src.splitlines() + result.append((lines[0], int(lines[1]), 2, url)) + yield result class UploadedTo(Hoster): __name__ = "UploadedTo" -- cgit v1.2.3