python - How to download torrent file -
im looking way download torrent file can work.
i found couple of similar question here , tried solutions cant work. heres have:
def get_torrent(site): results = site url = "https://nyaa.si/user/horriblesubs?f=0&c=0_0&q=horriblesubs+%5b720p%5d&p={}" opener = urllib.request.build_opener() opener.addheaders = [('user-agent', 'cern-linemode/2.15 libwww/2.17b3')] urllib.request.install_opener(opener) # note: global process line in results: name = "[horriblesubs] " + line + " [720p].mkv" urllib.request.urlretrieve(url, name)
the function gets list of episodes new , need downloaded, here example: isekai shokudou - 11, koi uso - 11.
i add rest of link styling , try download links above code download whole sites html code inside below files:
[horriblesubs] isekai shokudou - 11 [720p].mkv
and
[horriblesubs] koi uso - 11 [720p].mkv
so need way download actual .torrent files site mentioned in code
ok, got downloading of .torrent work now, code below:
def get_torrent(site): results = site url = "https://nyaa.si/download/958359.torrent" opener = urllib.request.build_opener() opener.addheaders = [('user-agent', 'cern-linemode/2.15 libwww/2.17b3')] urllib.request.install_opener(opener) # note: global process line in results: name = "[horriblesubs] " + line + " [720p].torrent" urllib.request.urlretrieve(url, name)
this downloads .torrent file link hardcoded url, , filename saved in loop. need figure out next how .torrent links automaticly inside loop animes in list. problem here way .torrent links on website im downloading them from.
Comments
Post a Comment