Files
Sandbox/SpotifyDownloader.ps1
Zack Meier 03dba08135 sync
2026-04-15 15:42:41 -05:00

20 lines
728 B
PowerShell

<#
Requirements:
Needs SpotDL python project installed
#>
New-Item -Path "D:\" -Name ("spotdl_" + (Get-Date -UFormat "%y%m%d")) -ItemType Directory
$RootUrl = "https://xmplaylist.com/api/station/thehighway/most-heard"
$DaysToReview = @(7, 30, 60)
ForEach ($subdays in $DaysToReview) {
#write-warning ($url + "?subdays=" + $subdays)
$result += Invoke-RestMethod -Uri ($RootUrl + "?subDays=" + $subdays) -Method Get -ContentType "application/json"
}
$UniqueTracks = ($Result | Select -Unique id).Id
ForEach ($Id in $UniqueTracks) {
$Url = (($Result | Where-Object Id -eq $Id | Select -First 1).links | where-object site -eq spotify | select -first 1).url
Invoke-Expression -Command ("spotdl " + $Url)
}