PowerShell: Automatically claiming Free Music from Google Play from Slickdeals Thread

Slickdeals posts these lists of free music from Google Play from time to time. The problem is that the lists can be huge (which is good, shouldn’t be complaining), which means a ton of clicking. This was a spur of the moment script to automate the tedious process. It’s ugly, but it’s going through and adding everything automatically. I’ll take it.

$musiclinks = (Invoke-WebRequest –Uri ‘https://slickdeals.net/f/8889299-free-mp3s-google-play’).Links | Where-Object {$_.InnerText -eq "google.com"}

$ie = (New-Object -COM "Shell.Application").Windows() `
        | ? { $_.Name -eq "Internet Explorer" }


ForEach ($musiclink in $musiclinks)
    {
    $ie.Navigate($musiclink.href)
    while($IE.busy) {Start-Sleep 1}
    sleep 2
    IF(($ie.Document.querySelector(".medium .id-track-impression").IHTMLElement_outerText).trim() -eq "Free")
        {
        $ie.Document.querySelector(".medium span").click()
        sleep 2
        while($IE.busy) {Start-Sleep 1}
        $ie.Document.querySelector("#loonie-purchase-ok-button > span").click()
        while($IE.busy) {Start-Sleep 1}
        sleep 5
        }

    ELSE{
        #$ie.Document.querySelector(".medium .id-no-nav").click()
        write-host "we already got this one."
        }
    }

Leave a Reply

Your email address will not be published. Required fields are marked *