Add Spotify links on iTunes album/artist pages

Is everyone sending you links from Apple Music? Here’s a userscript for Greasemonkey/Tampermonkey that adds Spotify links to iTunes album and artist pages.

iTunes album page with Spotify button

Download/Install

Tested in Chrome Tampermonkey and Firefox Greasemonkey. Currently broken in Safari Tampermonkey due to a combination of Apple adding CSP rules to their iTunes pages and Safari ignoring the CSP spec 🙁

Important changes in v4.0

  • Due to recent changes in the Spotify API authentication rules, search calls now require client credentials. Unfortunately, this means your searches must be sent through my server to make API calls on your behalf. If you have privacy concerns, you can use your own credentials and bypass my server (see “Options” section below).
  • The embedded Spotify player had to be removed due to Content Security Policy restrictions that were added in the Apple Music redesign.

Options

  • If you want the Spotify link to open in the Web Player instead of the desktop app, look for the open_in_app variable at the top of the script and set it to false.
  • If you want to use your own credentials to communicate with the Spotify API directly, first register an application with Spotify. Set up your Client ID and Secret in the “User preferences (advanced)” section at the top of the script.

Match accuracy

  • When multiple matches are found in the Spotify catalog, the first one will be used.
  • The script will try to work across different locales, but may fail to find a match when the album/artist name on the iTunes page is in an alternative language, like the Chinese 史密斯飞船合唱团 for Aerosmith. This is a limitation of the Spotify search API. Japanese queries seem to work most of the time, but not always.
  • The search API may have trouble finding a match due to minor naming discrepancies. If you suspect this is the case, you can always look for it manually on Spotify.

Updates

v4.0 — 2017/06/08

  • Fix for changes in Spotify API authentication rules
  • Fix for new Apple Music page design
  • Remove player embedding (now impossible due to Content Security Policy restrictions by Apple)
  • Make Spotify button a search link when no match found

v3.0 — 2017/01/29

  • Vastly improve album matching (Will now handle the majority of naming inconsistencies, including live albums and deluxe editions. Also tries fuzzier search queries for better matching of classical music and soundtracks. Sorry for the occasional false positives.)

v2.0 — 2016/11/04

  • Add option to embed Spotify player on album pages

Slack Plugin for Keyboard Maestro

This is a handy plug-in action I’ve been using to post messages to Slack from Keyboard Maestro.

Slack Plugin for Keyboard Maestro

It makes it super easy to integrate automated Slack posts in your workflows, or even set up an array of bots with different names and icons.

How to use

Make sure you have an Incoming Webhook integration set up. If you don’t, make one. (The settings here don’t really matter because the target channel, username, and icon can all be overridden from the Keyboard Maestro action.)

  • Webhook URL: Paste the URL (https://hooks.slack.com/services/…) here
  • Channel or DM: Choose a #channelname to post to, or a @username for direct messages (Tip: For testing purposes, put your own username here so nobody else will see the posts!)
  • Username: A name for your bot
  • Icon Type: Icons can either be an Emoji or pulled from a URL
  • Icon: If you chose Emoji in the previous field, put an emoji shortcut name here. Otherwise specify an image URL.

Download

Drop the .zip file on the Keyboard Maestro dock icon to install. Requires Keyboard Maestro 6.

Updates

To update an existing action, remove it from the Keyboard Maestro Actions folder (~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions) and reinstall the new version.

2015/03/24

  • Escape double quotes in Username/Message fields
  • Preserve line breaks in Message field

TextSoap Actions for Keyboard Maestro

Here are two Plug-in Actions for using TextSoap cleaners in Keyboard Maestro.

TextSoap actions for Keyboard Maestro

How to use

Put the full name of a TextSoap cleaner in the Cleaner field. Text tokens can also be used here.

Note that the “Clean Plain Text” version will not retain any formatting in rich text input, even if a clipboard is specified. To keep rich text formatting in tact or to apply rich text cleaners, you must use the “Clean Clipboard” action.

Download

Drop the .zip file on the Keyboard Maestro dock icon to install. Requires TextSoap 8 and Keyboard Maestro 6+.

Updates

To update an existing action, remove it from the Keyboard Maestro Actions folder (~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions) and reinstall the new version.

2017/01/01

  • Updated for TextSoap 8

iTunes: 30-second skip podcasts/audiobooks only

Here’s a nice AppleScript I use to rewind or skip 30 seconds in iTunes, but only when the current track is a podcast or audiobook.

This allows you to have a single keyboard shortcut that works as a normal “previous track” key when listening to music, but automatically switches to a 30-second rewind when listening to podcasts, audiobooks, or whatever else you specify.

property skip_secs : 30 -- use negative value to rewind, positive value to skip ahead
property genre_list : {"Podcast", "Books & Spoken"}

tell application "iTunes"
	if (exists of current track) is false then
		return
	end if
	
	if genre of current track is in genre_list then
		set target_time to (player position + skip_secs)
		
		if (target_time > finish of current track) then
			next track
		else if (target_time < 2) then
			back track
		else
			set player position to target_time
		end if
		
	else -- rewind/skip the whole track
		if (skip_secs < 0) then
			back track
		else
			next track
		end if
	end if
end tell

Options

Change the skip_secs property to your preferred interval in seconds. For example, setting skip_secs to 30 will result in a 30-sec fast forward, while setting it to -15 will make it a 15-sec rewind.

If you would like more kinds of tracks to respond to this skip behavior, add the genre names of those tracks to genre_list.