1
0
mirror of https://github.com/vikstrous/pirate-get synced 2025-01-10 10:04:21 +01:00

"sizes" and "uploaded" lists get generated for every page

user extend() instead to avoid exception
This commit is contained in:
stoneage7 2014-05-13 21:02:43 +02:00
parent 947286dc51
commit a492f49b1f

View File

@ -85,6 +85,8 @@ def main():
# Catch the Ctrl-C exception and exit cleanly
try:
sizes = []
uploaded = []
for page in xrange(pages):
request = urllib2.Request(mirror + '/search/' + args.q.replace(" ", "+") + '/' + str(page) + '/7/0')
request.add_header('Accept-encoding', 'gzip')
@ -104,8 +106,8 @@ def main():
# get sizes as well and substitute the   character
# print res
sizes = [ match.replace("&nbsp;", " ") for match in re.findall("(?<=Size )[0-9.]+\&nbsp\;[KMGT]*[i ]*B",res) ]
uploaded = [ match.replace("&nbsp;", " ") for match in re.findall("(?<=Uploaded ).+(?=\, Size)",res) ]
sizes.extend([match.replace("&nbsp;", " ") for match in re.findall("(?<=Size )[0-9.]+\&nbsp\;[KMGT]*[i ]*B",res)])
uploaded.extend([match.replace("&nbsp;", " ") for match in re.findall("(?<=Uploaded ).+(?=\, Size)",res)])
# pprint(sizes); print len(sizes)
# pprint(uploaded); print len(uploaded)
state = "seeds"