 Okay, today we're going to be looking at downloading torrent files on a Linux system. So, obviously we can do this simply with a GUI, such as CupidTorrent. But what about from the shell? We can use programs like Area2C, which is a great program for downloading torrents. But I also want to be able to search for torrents right from the shell. Again, if you're looking for a GUI interface, CupidTorrent has a built-in search engine, which is great. But I wrote a script, very simple. I'm going to show you how it works, tell you where to get it. And then you can also look over the code, and we'll look at it a little bit today. But it's super simple to use. So let's go ahead and jump right in. So again, here is a GUI interface. This is CupidTorrent. Should be in the repositories for your distribution. And if I go to search, I can search for Debian, right? And it will start searching many different websites for Debian. And you can search filter things by seeds and size. And then you can download one of those ISOs. If I was to do Oven 2, you can see that it will search for Oven 2. And then I can click on that and download them, which is great. But again, let's see how to do it from the shell. Now, if you have a link for a magnet link or torrent, you can use area to see which should be in repositories for most distributions and just give it the URL to the torrent or magnet link. But again, we want to be able to search. Now, I have created a script and I just, on my system, I just call it torrent. So I just do torrent, right? And I can say Debian. And when I do that, it's going to search a website, gives me the URL there. Let me get a little smaller so you can see a little bit better. And it lists out things. It's using fcf. So you have to have fcf installed for this, which should, again, also be in repositories. And I can filter the list, you know, like so. It is giving it a, it's ordered by the highest number of seeds. So the first one here at the bottom is going to have the highest number of seeds. But I can go through here and go, okay, I want Debian 11. I want Debian 9. And again, you can type to filter. So I can type in Debian and it will filter out the list a little bit. So I can click that and it's just going to start downloading. And it will tell me here, okay, this is what we searched. You can actually go to that website if you want to see all the options on the website. Here's the output file name. And it's going to try to grab the file size and the number of seeds. Sometimes this doesn't get displayed because I am just scraping the website. And I guess sometimes it loads a little differently. Let me just go ahead and go Ctrl C to kill that. Let's run it again. I can say torrent, move into. And when I run that, it's going to do the search there. I can come through here and choose one of these. And it will start downloading it using area2c. And again, it will tell me here the file size and the number of seeds. So again, I can go ahead and kill that. If you just type in torrent and don't give it anything, it will ask you for a query. So I can say like Linux, right? And it will start listing out Linux things here. And I can type in ISO to see if any ISOs. There's Cali Linux. I can hit enter and it will start downloading it. So that is how my script works. And again, it shows you the URL right here that it's searching. Let's go ahead and let's go vim, usr, local, bin, torrent. And I will have a link to this script in the description of this video. But again, we have the URL here. Here it's just checking, okay, did you give some sort of input? If so, make that our query. And if not, request one. After that, I should probably have it checked again to make sure you actually entered something here if not exit. Let's go ahead and just do that right now. That sounds like a good idea. So here I'm going to say, okay, if dollar sign Q does not exist, then exit one, or I guess exit, whether you want to consider that an error or not is your decision. So basically here, it's saying, okay, if nothing was entered here, just go ahead and exit out of the script. Here, we're just looking at the URL and replacing any spaces with percent 20. This is the opposite of what I did in another script. But sometimes the URLs will have spaces in them, which can cause problems. So we're just replacing it with the HTTP characters for space, which is percent 20. Wget to get our URL here with our search, scrape through the page, basically, and then we're going to create a list. This is just scraping the page, basically, getting the Pirate Bay website, HTML, and scraping away the stuff until we get the list we need. And then we're going to pipe that into FZF. And we're going to make a selection. Okay, if you don't select anything, well, then we will exit. And then next, if you did select something from the list, then it's going to use that, it's going to do a little more cutting because the list gives you the torrent name, like the title of it. And then actually we'll get the magnet link. So here, we're going to get the title, that's going to echo the title. So in our example, it was the Debian ISO. And then here, it's going to try to display the size and number of seeds. Again, this doesn't always work 100%. But most time, it will give you the seeds and the size of the file. Even if that doesn't work, it will continue, it will get the magnet link from your selection. And it will check, okay, was there a magnet link, making sure that it did grab something. If not, it will exit with an error. It's going to dump that to our history. So for some reason, you cut it off, you can always go back, I'm using a ZShell. So it's going to the ZShell history. So I can just go up in my history and restart if I need to. But then it's just going to run. And then it's going to use seed time one mega leak. What's the seed time one? Once it's done downloading, it just it's basically going to stop. So you're not going to be sharing the file. That's up to you whether you want to leave it going or not. If you want, once it's downloading to be a seed, you can just go ahead and remove this section here. Check out the link in the description to the script. I hope that you find it useful. If you make any improvements to it, I'd love to see it. I have it up on GitLab. So go ahead and make your modifications there for it and, you know, then share that. But I hope you found this useful. I hope you find this script useful. And I hope you share it. And as always, please visit filmsbychrist.com. That's Chris of the K. There's a link in the description. As always, I hope that you have a great day.