Im looking for a way to download a torrent file but i can get it to work.
I found couple of similar question here and tried the solutions but i cant get it to work. Heres what i 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 for the process
for line in results:
name = "[HorribleSubs] " + line + " [720p].mkv"
urllib.request.urlretrieve(url, name)
The function gets a list of episodes that are new and need to be downloaded, here is an example: Isekai Shokudou - 11, Koi to Uso - 11.
I then add the rest of the link styling and try to download the links but all the above code does is download the whole sites html code inside the below files:
[HorribleSubs] Isekai Shokudou - 11 [720p].mkv
and
[HorribleSubs] Koi to Uso - 11 [720p].mkv
So i need a way to download the actual .torrent files from the site mentioned in the code
Ok, i got the downloading of .torrent to work now, code below:
This downloads the .torrent file from link that is hardcoded to url, and the filename that it is saved as is in the for loop. Need to figure out next how to get the .torrent links automaticly inside the for loop for all animes in the list. Problem here is the way the .torrent links are on the website im downloading them from.