diff --git a/pirate-get.py b/pirate-get.py index 5db4434..d94b6ff 100755 --- a/pirate-get.py +++ b/pirate-get.py @@ -37,8 +37,9 @@ class MyHTMLParser(HTMLParser): def main(): - parser = argparse.ArgumentParser(description='Finds and downloads torrents from the Pirate Bay') + parser.add_argument('q', metavar='search_term', help="The term to search for") + parser.add_argument('--local', dest='database', help="An xml file containing the Pirate Bay database") def local(args): xml_str = '' @@ -52,9 +53,6 @@ def main(): f = urllib2.urlopen('http://thepiratebay.se/search/' + args.q.replace(" ", "+") + '/0/7/0') return re.findall(""""(magnet\:\?xt=[^"]*)""", f.read()) - parser.add_argument('q', metavar='search_term', help="The term to search for") - parser.add_argument('--local', dest='database', help="An xml file containing the Pirate Bay database") - args = parser.parse_args() if args.database: mags = local(args)