Skip to content

Instantly share code, notes, and snippets.

@a-sync
a-sync / radio1-downloader.bat
Last active May 31, 2023 20:25
radio1.hu tracklista URL alapján letölti az mp3 fájlokat
@echo off
title radio1-downloader @ https://gist.github.com/a-sync
powershell -NoProfile -ExecutionPolicy Unrestricted -Command "[System.Net.ServicePointManager]::SecurityProtocol=[System.Net.SecurityProtocolType]::Tls12;[System.Net.WebRequest]::DefaultWebProxy.Credentials=[System.Net.CredentialCache]::DefaultCredentials;$Url=Read-Host -Prompt 'radio1.hu URL';$wc=New-Object System.Net.WebClient;$wc.Encoding=[System.Text.Encoding]::UTF8;$Links=$wc.DownloadString($Url.Trim())|Select-String -Pattern '<audio data-artist=\""(.*?)\"" data-title=\""(.*?)\"".*?>\n.*?<source src=\""(.*?)\"" type=\""audio/mp3\"">' -AllMatches;Foreach($i in $Links.Matches){$Name=\""$($i.Groups[1].Value) $($i.Groups[2].Value)\"".Split([IO.Path]::GetInvalidFileNameChars()) -join '_';Write-Host $Name;$wc.Headers.Add('Referer','https://www.radio1.hu');$wc.DownloadFile(\""https://www.radio1.hu$($i.Groups[3].Value)\"",\""$Name.mp3\"")}"