Skip to content
Blue-A-no-circle

Archi's Tech Repository

Where my digital bytes live on, so grab a byte and relax

  • Home
    • My NFT Creations
    • @DailyMotion
    • @Twitter
    • On GitHub
  • Energy
  • 3D Printing
  • Arduino-Rpi
  • Crypto
  • Gaming
    • Archived copies of the FrontRunnerTek Server Manager for 7DTD
    • Marvel Strike Force Blitz Team Builder
  • PowerShell
  • Stocks
  • Toggle search form

Torrent Download Client Helper Script

Posted on 2021-04-302021-04-30 By Archi No Comments on Torrent Download Client Helper Script
Spread the love

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)
Crypto, PowerShell Tags:bittorrent, crypto, PowerShell, rarbg, torrent, utorrent

Post navigation

Previous Post: Have a piece of Pi, free on me
Next Post: Unlock Space Engineers DLC content

Leave a Reply Cancel reply

You must be logged in to post a comment.

QR Link to this page

QR Code

Recent Posts

  • Getting Generic SD SPI card readers to work with ESP32-DevKitC-32UE boards
  • Modifications and non-traditional use of an AEROCART 8-IN-1 YARD CART / WHEELBARROW / DOLLY
  • Grid-Down Battery Backup
  • Wordle – Modified
  • An easy solution to differentiate between multiple instances of Sonarr, Radarr, Lidarr… all the ARRSS
Buy VPN

Categories

Copyright © 2023 Archi's Tech Repository.

Powered by PressBook Dark WordPress theme