From 25f29e7e303d8089143d36675e86ce8aa1d81aa9 Mon Sep 17 00:00:00 2001 From: repic Date: Tue, 10 Dec 2013 14:41:56 +0100 Subject: [PATCH] Sizes fix Fixed the regular expression so that sizes in bytes (B) work properly. --- pirate-get.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pirate-get.py b/pirate-get.py index 0c32a01..2491712 100755 --- a/pirate-get.py +++ b/pirate-get.py @@ -5,6 +5,7 @@ import urllib2 import re from HTMLParser import HTMLParser import argparse +from pprint import pprint # create a subclass and override the handler methods @@ -69,10 +70,10 @@ def main(): # get sizes as well and substitute the   character # print res - sizes = [ match.replace(" ", " ") for match in re.findall("(?<=Size )[0-9.]+\ \;[KMGT]iB",res) ] + sizes = [ match.replace(" ", " ") for match in re.findall("(?<=Size )[0-9.]+\ \;[KMGT]*[i ]*B",res) ] uploaded = [ match.replace(" ", " ") for match in re.findall("(?<=Uploaded ).+(?=\, Size)",res) ] - # print sizes - # print uploaded + # pprint(sizes); print len(sizes) + # pprint(uploaded); print len(uploaded) state = "seeds" curr = ['',0,0] #magnet, seeds, leeches for f in found: