mirror of
https://github.com/cooperhammond/irs.git
synced 2024-12-22 17:35:28 +00:00
Added functionality to get a different torrent rather than the very first result (cause KAT search functionality is not the best 😠
This commit is contained in:
parent
a7cd1d631c
commit
ba18e8026c
18
README.md
18
README.md
|
@ -63,19 +63,19 @@ On a personal judgement, we would judge that the complete meta-data parsing work
|
|||
|
||||
### Usage
|
||||
```bash
|
||||
$ IRS (stream | download) movie <movie-name>
|
||||
$ IRS (stream | download) tv <tv-show> <episode>
|
||||
$ IRS (stream | download) song <song-name> by <artist>
|
||||
$ IRS (stream | download) album <album-name> by <artist>
|
||||
$ irs (stream | download) movie <movie-name>
|
||||
$ irs (stream | download) tv <tv-show> <episode>
|
||||
$ irs (stream | download) song <song-name> by <artist>
|
||||
$ irs (stream | download) album <album-name> by <artist>
|
||||
```
|
||||
|
||||
##### Examples
|
||||
```bash
|
||||
$ IRS stream movie Fight Club
|
||||
$ IRS download album A Night At The Opera by Queen
|
||||
$ IRS stream song Where Is My Mind by The Pixies
|
||||
$ IRS download tv mr.robot s01e01
|
||||
$ IRS stream album A Day At The Races by Queen
|
||||
$ irs stream movie Fight Club
|
||||
$ irs download album A Night At The Opera by Queen
|
||||
$ irs stream song Where Is My Mind by The Pixies
|
||||
$ irs download tv mr.robot s01e01
|
||||
$ irs stream album A Day At The Races by Queen
|
||||
```
|
||||
### Disclaimer
|
||||
Copyrighted content may be illegal to stream and/or download in your country.
|
||||
|
|
17
irs.py
17
irs.py
|
@ -184,24 +184,21 @@ def get_album(album_name, artist, what_to_do):
|
|||
|
||||
def get_torrent_url(args, category):
|
||||
search_url = 'https://kat.cr/usearch/' + urllib.parse.quote_plus((" ".join(args) + " category:" + category))
|
||||
print (search_url)
|
||||
#time.sleep(5)
|
||||
search_request_response = requests.get(search_url, verify=True)
|
||||
soup = BeautifulSoup(search_request_response.text, 'html.parser')
|
||||
|
||||
choice = False
|
||||
i = 0
|
||||
print ("")
|
||||
while choice == False:
|
||||
movie_page = soup.find_all("a", class_="cellMainLink")[i]
|
||||
print (movie_page.string)
|
||||
a = input("%s Is this torrent what you want? Y/n " % output("q"))
|
||||
if a.lower() == 'y':
|
||||
search_url = requests.get('https://kat.cr' + movie_page.get('href'), verify=True)
|
||||
movie_page = soup.find_all("a", class_="cellMainLink")
|
||||
for number in range(0,5):
|
||||
print ("%s. " % (number + 1) + movie_page[number].string)
|
||||
a = int(str(input("\n%s What torrent would you like? " % output("q")))) - 1
|
||||
if a in (0, 1, 2, 3, 4):
|
||||
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')
|
||||
choice = True
|
||||
elif a == 'n':
|
||||
i += 1
|
||||
return torrent_url
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Reference in a new issue