From 1a5661b373c697708d46c1bebb4a04c1a110db71 Mon Sep 17 00:00:00 2001 From: lalanza808 Date: Fri, 27 Mar 2015 13:50:18 -0700 Subject: [PATCH] Updating script, squelch ssh warnings --- pirate.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pirate.py b/pirate.py index f463a65..d332776 100755 --- a/pirate.py +++ b/pirate.py @@ -13,6 +13,7 @@ __author__ = 'LANCE' # Built-in libraries +import urllib3 from platform import system as operatingSystem from os import path, system from urllib import urlretrieve @@ -28,13 +29,20 @@ results = {} links = [] choice = "" tpb = "https://thepiratebay.se" + +# Squelch SSL warnings +urllib3.disable_warnings() def getSearchURL(): """ Takes input string to search for on TPB. Formats string into proper url """ - searchString = raw_input("[+] What would you like to search?\n>") + try: + searchString = raw_input("[+] What would you like to search?\n>") + except KeyboardInterrupt: + print "\n\nLater bro." + exit(0) searchURL = "{}/search/{}/0/7/0".format(tpb, searchString) #/0/7/0 tells TPB to sort descending by seeds pageSource = requests.get(searchURL, verify=False).text #Use requests lib to fetch page source for bs4 parsing analyzeURL(pageSource) #Run analyzeURL function, passing page source