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:
Kepoor Hampond 2016-07-09 21:05:32 -07:00
parent a7cd1d631c
commit ba18e8026c
2 changed files with 17 additions and 20 deletions

View file

@ -20,7 +20,7 @@ $ python install -r requirements.txt
There are some more external command-line programs that are essential to movies, tv-shows, and streaming:
- rTorrent: [Windows](https://rtwi.jmk.hu/wiki/rTorrentOnWindows), [OSX](http://macappstore.org/rtorrent/), Ubuntu:
```bash
$ sudo apt-get install rtorrent
```
@ -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
View file

@ -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():