mirror of
https://github.com/cooperhammond/irs.git
synced 2024-12-22 17:35:28 +00:00
Made selecting of torrent urls easier because it was bugging me.
This commit is contained in:
parent
894e0a4c9e
commit
9d353ec2a5
34
irs.py
34
irs.py
|
@ -200,29 +200,37 @@ def get_album(album_name, artist, what_to_do):
|
||||||
|
|
||||||
def get_torrent_url(args, category):
|
def get_torrent_url(args, category):
|
||||||
search_url = 'https://kat.cr/usearch/' + urllib.parse.quote_plus((" ".join(args) + " category:" + category))
|
search_url = 'https://kat.cr/usearch/' + urllib.parse.quote_plus((" ".join(args) + " category:" + category))
|
||||||
print (search_url)
|
|
||||||
search_request_response = requests.get(search_url, verify=True)
|
search_request_response = requests.get(search_url, verify=True)
|
||||||
soup = BeautifulSoup(search_request_response.text, 'html.parser')
|
soup = BeautifulSoup(search_request_response.text, 'html.parser')
|
||||||
choice, results, ran_out = False, True, False
|
results, ran_out = 0, False
|
||||||
i = 0
|
i = 0
|
||||||
print ("")
|
print ("")
|
||||||
while choice == False:
|
while True:
|
||||||
movie_page = soup.find_all("a", class_="cellMainLink")
|
movie_page = soup.find_all("a", class_="cellMainLink")
|
||||||
for number in range(0,10):
|
for number in range(0,10):
|
||||||
try:
|
try:
|
||||||
print ("%s. " % (number + 1) + movie_page[number].string)
|
print ("%s. " % (number + 1) + movie_page[number].string)
|
||||||
|
results += 1
|
||||||
except Exception:
|
except Exception:
|
||||||
if ran_out == False:
|
ran_out = True
|
||||||
print (output('e') + " End of results.")
|
|
||||||
ran_out = True
|
|
||||||
pass
|
pass
|
||||||
a = int(str(input("\n%s What torrent would you like? " % output("q")))) - 1
|
if ran_out == True:
|
||||||
if a in tuple(range(0, 10)):
|
if results == 0:
|
||||||
search_url = requests.get('https://kat.cr' + movie_page[a].get('href'), verify=True)
|
print (output('e') + " No results.\n")
|
||||||
soup = BeautifulSoup(search_url.text, 'html.parser')
|
exit(0)
|
||||||
torrent_url = 'https:' + soup.find_all('a', class_='siteButton')[0].get('href')
|
else:
|
||||||
choice = True
|
print (output('e') + " End of results.")
|
||||||
return torrent_url
|
if results != 0:
|
||||||
|
|
||||||
|
try: a = int(str(input("\n%s What torrent would you like? " % output("q")))) - 1
|
||||||
|
except Exception: a = 100; pass
|
||||||
|
# This code is either hyper-efficient, or completely against every ettiquite.
|
||||||
|
|
||||||
|
if a in tuple(range(0, 10)):
|
||||||
|
search_url = requests.get('https://kat.cr' + movie_page[a].get('href'), verify=True)
|
||||||
|
soup = BeautifulSoup(search_url.text, 'html.parser')
|
||||||
|
torrent_url = 'https:' + soup.find_all('a', class_='siteButton')[0].get('href')
|
||||||
|
return torrent_url
|
||||||
|
|
||||||
def rip_playlist(file_name, what_to_do):
|
def rip_playlist(file_name, what_to_do):
|
||||||
txt_file = open(file_name, 'r')
|
txt_file = open(file_name, 'r')
|
||||||
|
|
Loading…
Reference in a new issue