Last active
November 23, 2025 22:18
-
-
Save DarthJahus/958042d837206542b90a45ebb62e3e7b to your computer and use it in GitHub Desktop.
Check folders for .url files and download YouTube playlists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [string]$BaseFolder = "F:\.temp\dl", | |
| [string]$YTDLScript = ".\ytdl.ps1", | |
| [string]$DownloadFolder = $null, | |
| [string]$YTDL = $null, | |
| [string]$Cookies = $null, | |
| [string]$DownloadArchive = $null, | |
| [int]$MinDuration = $null, | |
| [int]$MaxDuration = $null | |
| ) | |
| if (-not (Test-Path $BaseFolder)) { | |
| Write-Host "Le dossier de base n'existe pas: $BaseFolder" -ForegroundColor Red | |
| exit | |
| } | |
| # Recuperation des dossiers contenant des fichiers .URL | |
| $folders = Get-ChildItem -Path $BaseFolder -Directory | |
| foreach ($folder in $folders) { | |
| $urlFile = Get-ChildItem -Path $folder.FullName -Filter *.URL | Select-Object -First 1 | |
| if (-not $urlFile) { | |
| Write-Host "Aucun fichier .URL trouve dans $($folder.FullName), skipping." -ForegroundColor Yellow | |
| continue | |
| } | |
| # Lecture du lien de la playlist dans le fichier .URL | |
| $playlistLine = Get-Content -Path $urlFile.FullName -Encoding UTF8 | Where-Object { $_ -match "^URL=" } | Select-Object -First 1 | |
| if (-not $playlistLine) { | |
| Write-Host "URL introuvable dans $($urlFile.FullName), skipping." -ForegroundColor Yellow | |
| continue | |
| } | |
| $playlistUrl = $playlistLine -replace "^URL=", "" | |
| Write-Host "Telechargement depuis $playlistUrl dans $($folder.FullName)" | |
| # Construction des arguments pour ytdl.ps1 | |
| $params = @{ | |
| Urls = $playlistUrl | |
| DownloadFolder = $folder.FullName # Utilise le dossier actuel | |
| } | |
| if ($YTDL) { $params['YTDL'] = $YTDL } | |
| if ($Cookies) { $params['Cookies'] = $Cookies } | |
| if ($DownloadArchive) { $params['DownloadArchive'] = $DownloadArchive } | |
| if ($null -ne $MinDuration) { $params['MinDuration'] = $MinDuration } | |
| if ($null -ne $MaxDuration) { $params['MaxDuration'] = $MaxDuration } | |
| # Execution du script ytdl.ps1 | |
| & $YTDLScript @params | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment