Torrent Download Client Helper Script
This script was created for use with RARBG and the uTorrent and Bittorrent clients as their internal RSS feed and downloaders don’t work consistently. This script supports basic filter matching and Regular Expression (RegEx) matching. It also supports multiple RSS feeds for RARBG. It will keep track of downloaded torrents so as to not redownload them. By default it refreshes the RSS feeds every 15 minutes (900 seconds).
Ensure your download client is configured as the default handler for .magnet links.
This is provided for educational purposes only as example of automating processes, performing web calls and filtering using regular expressions. Links and configurations provided are for example use only.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# RARBG RSS Feed Torrent Downloader # Ensure magnet links are associated with your download client $feeds = @('https://rarbg.to/rssdd.php?categories=44') # rarbg rss feed for movies $filterMatch = '' # leave this empty if using regex match $filterRegExMatch = '.+202[0-9].+-rarbg' # leave this empty if using non-regex match, matches 2020-2029 rarbg only $filterNotMatch = '' # exclude titles with this filter, only used with $filterMatch $downloaded = "$env:USERPROFILE\desktop\DLhistory.txt" # file for download history $sleepTime = 900 # in seconds. 900 seconds = 15 minutes, the normal RSS feed refresh timeframe # ================================== Change Nothing Below ===================================== $stop = $false If (!(Test-Path $downloaded)) { New-Item -Path $downloaded -ItemType File | Out-Null # create the history file if it doesn't exist } do { cls ForEach ($feed in $feeds) { # process each feed in our feeds list $xmlResult = Invoke-RestMethod -Method Get -Uri $feed -ErrorAction SilentlyContinue If ($xmlResult) { # if we got results from the rss feed url, process them ForEach ($torrent in $xmlResult) { # process each torrent found in the results If ($filterMatch -ne '') { # Filter using normal search If ($torrent.title -like $filterMatch -and $torrent.title -notlike $filterNotMatch) { Write-Host $($torrent.Title) -ForegroundColor Cyan If ( $(Get-Content -Path $downloaded) -notcontains $torrent.title ) { Add-Content -Path $downloaded -Value $torrent.title Write-Host $($torrent.link) -ForegroundColor Green start $torrent.link } Else { Write-Host "$($torrent.title) already downloaded" -ForegroundColor Yellow } } Else { Write-Host $($torrent.title) -ForegroundColor Red } } ElseIf ($filterRegExMatch -ne '') { # Filter using RegEx $regOpts = [System.Text.RegularExpressions.RegexOptions]::IgnoreCase $regMatch = [regex]::Match($torrent.title, $filterRegExMatch,$regOpts) If ($regMatch.Success -eq $true) { Write-Host $($torrent.Title) -ForegroundColor Cyan If ( $(Get-Content -Path $downloaded) -notcontains $torrent.title ) { Add-Content -Path $downloaded -Value $torrent.title Write-Host $($torrent.link) -ForegroundColor Green start $torrent.link } Else { Write-Host "$($torrent.title) already downloaded" -ForegroundColor Yellow } } Else { Write-Host $($torrent.title) -ForegroundColor Red } } Else { # Grab Everything since filters are empty Write-Host $($torrent.Title) -ForegroundColor Cyan If ( $(Get-Content -Path $downloaded) -notcontains $torrent.title ) { Add-Content -Path $downloaded -Value $torrent.title Write-Host $($torrent.link) -ForegroundColor Green start $torrent.link } Else { Write-Host "$($torrent.title) already downloaded" -ForegroundColor Yellow } } } } } Write-Host "Sleeping... $(Get-Date)" -ForegroundColor Magenta sleep -Seconds $sleepTime } Until ($stop -eq $true) |