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

Merge pull request #22 from stoneage7/master

-p option doesn't work for me
This commit is contained in:
Viktor Stanchev 2014-05-14 00:23:24 -04:00
commit 2ec57f7cd0

View File

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