I've got a lot of song in iTunes music library and would like to know for which songs there are music videos available. But, the only way I have found to do that is to manually search for videos for each song and this process is simply impractical.

I figure there must be an easy way to know if there is video which I can purchase for every song in my library.

2 Answers 2


You can try what this fellow suggested as an answer because I think you can easily import iTunes tracks to the Spotify application.

That's the only way I can think of.


An imperfect solution, but one that will return a reasonable accurate set of results. This is based on being able to use AppleScript with iTunes and a published API to perform searches at the iTunes Store. The key aspect that makes this solution imperfect is that the data I can get out of iTunes (artist names, etc.) does not necessarily match what the iTunes store has in its database.

This AppleScript does require that 'JSON Helper' application from the App Store. It is free. I needed it to be able to parse the JSON I get back from Apple.

set _string to load script alias ((path to desktop as text) & "_string.scpt")
set _url to load script alias ("Macintosh HD:Users:ericgorr:depot:AppleScript:Library:_url.scpt")

set this_file to (((path to desktop folder) as text) & "videos")

tell application "iTunes"

    copy (count of tracks in playlist "4+") to trackCount

    log trackCount

    copy "https://itunes.apple.com/search?entity=musicVideo" to baseURL

    repeat with x from 1 to trackCount

        copy (artist of track x in playlist "4+") to theArtist
        copy (name of track x in playlist "4+") to theSongName

        copy (_url's urlEncode(theSongName)) to encodedSongName
        copy (baseURL & "&term=" & encodedSongName) to searchURL

        my write_to_file(theArtist & return, this_file, true)

        tell application "JSON Helper"
            set iTunesResults to fetch JSON from searchURL
            set resultCount to resultCount of iTunesResults

            repeat with y from 1 to resultCount

                set aResult to item y of results of iTunesResults

                set trackURL to trackViewUrl of aResult
                set returnedArtistName to artistName of aResult

                set outputLine to tab & returnedArtistName & tab & theSongName & tab & trackURL & return

                my write_to_file(outputLine, this_file, true)

            end repeat

        end tell
    end repeat

end tell

on write_to_file(this_data, target_file, append_data) -- (string, file path as string, boolean)
        set the target_file to the target_file as text
        set the open_target_file to ¬
            open for access file target_file with write permission
        if append_data is false then ¬
            set eof of the open_target_file to 0
        write this_data to the open_target_file starting at eof
        close access the open_target_file
        return true
    on error
            close access file target_file
        end try
        return false
    end try
end write_to_file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .