Skip to content

Instantly share code, notes, and snippets.

@ihercowitz
Last active August 29, 2015 14:19
Show Gist options
  • Save ihercowitz/6d152714bdda773f6aaa to your computer and use it in GitHub Desktop.
Save ihercowitz/6d152714bdda773f6aaa to your computer and use it in GitHub Desktop.
Script to download series on kickassTorrents, using Aria
# -*- coding: utf-8 -*-
import requests
from lxml.html import fromstring
import os, sys
piratebay = "https://thepiratebay.se/search/{0}/0/99/0"
kickass = "https://kickass.to/usearch/{0}/"
magnet=lambda link, local: os.system('aria2c --conf-path=$HOME/.aria2c.torrent --max-download-limit=1100K --max-upload-limit=15K --listen-port=63654 "' + link + '" -d '+ local +' --seed-time=1')
def pbget(tvshow):
url = kickass.format(tvshow.replace(" ", "%20"))
print url
r = requests.get(url, verify=False)
return r
def eps(tvshow, season, start, end):
for x in range (start, end+1):
show = "%s %se%s" %(tvshow, season, ("0"+str(x) if x < 10 else str(x)))
url = pbget(show)
link = fromstring(url.text).cssselect('a.imagnet')[0].get('href')
magnet(link, "~/Vídeos/Seriados/"+tvshow.replace(" ","_"))
if __name__ == "__main__":
tvshow = sys.argv[1]
season = sys.argv[2]
start = int(sys.argv [3])
end = int(sys.argv [4]) if len(sys.argv) == 5 else start
eps(tvshow, season, start, end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment