<# 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) }