diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-12 22:44:41 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-12 22:44:41 +0200 |
commit | 72abfb455275546e110e4daf811480dd47ffceea (patch) | |
tree | 4f6955a97af4600c31dffc5941a57640d81da0a3 /module/plugins/hoster/NetloadIn.py | |
parent | encoding fix try (diff) | |
download | pyload-72abfb455275546e110e4daf811480dd47ffceea.tar.xz |
improvements
Diffstat (limited to 'module/plugins/hoster/NetloadIn.py')
-rw-r--r-- | module/plugins/hoster/NetloadIn.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 9e117fa14..6f0cb9461 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -4,8 +4,12 @@ import re from time import sleep + from module.plugins.Hoster import Hoster from module.network.Request import getURL +from module.plugins.Plugin import chunks + + def getInfo(urls): ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url) @@ -14,14 +18,10 @@ def getInfo(urls): apiurl = "http://api.netload.in/info.php?auth=Zf9SnQh9WiReEsb18akjvQGqT0I830e8&bz=1&md5=1&file_id=" id_regex = re.compile("http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)") urls_per_query = 80 - - iterations = len(urls)/urls_per_query - if len(urls)%urls_per_query > 0: - iterations = iterations +1 - - for i in range(iterations): + + for chunk in chunks(urls, urls_per_query): ids = "" - for url in urls[i*urls_per_query:(i+1)*urls_per_query]: + for url in chunk: match = id_regex.search(url) if match: ids = ids + match.group(1) +";" @@ -37,19 +37,17 @@ def getInfo(urls): result = [] - counter = 0 - for r in api.split(): + for i, r in enumerate(api.split()): try: tmp = r.split(";") try: size = int(tmp[2]) except: size = 0 - result.append( (tmp[1], size, 2 if tmp[3] == "online" else 1, urls[(i*80)+counter]) ) + result.append( (tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i] ) ) except: print "Netload prefetch: Error while processing response: " print r - counter = counter +1 yield result |