Skip to content

Instantly share code, notes, and snippets.

@MuTLY
Forked from Caedilla/Filter.js
Created September 17, 2025 17:30
Show Gist options
  • Select an option

  • Save MuTLY/40ca2cf31b99202372ac4c65e0ba4b1c to your computer and use it in GitHub Desktop.

Select an option

Save MuTLY/40ca2cf31b99202372ac4c65e0ba4b1c to your computer and use it in GitHub Desktop.
IFTTT Youtube liked video to Spotify playlist filter
// Removes stuff from YouTube video names to make it easier to find the song on Spotify
// Add this to the filter section of your IFTTT applet after the Youtube Trigger, before Spotify.
// Spotify title in the applet settings can be whatever (so long as it's not empty) this replaces it.
var title = Youtube.newLikedVideo.Title
// Some videos use a dash or colon instead of hyphen.
var titleSplit = title.split('-')
if (titleSplit.length != 2){
titleSplit = title.split('–')
if (titleSplit.length != 2){
titleSplit = title.split(':')
}
}
if (titleSplit.length == 2) {
var artistName = titleSplit[0].trim()
var trackName = titleSplit[1].trim()
// Remove non-track name stuff
var trackTerms = ['ft. ', 'ft ', 'feat. ', 'feat ', 'featuring ', '(', '['],
sl = trackTerms.length
while (sl--) {
if (trackName.indexOf(trackTerms[sl])!=-1) {
var removeIndex = (trackName.indexOf(trackTerms[sl]))
var removeString = (trackName.slice(removeIndex))
trackName = trackName.replace(removeString, '')
}
}
// Remove subsequent artists
var artistTerms = ['/',' & ',',',' and '],
al = artistTerms.length
while (al--) {
if (artistName.indexOf(artistTerms[al])!=-1){
var removeIndex = (artistName.indexOf(artistTerms[al]))
var removeString = (artistName.slice(removeIndex))
artistName = artistName.replace(removeString,'')
}
}
trackName = trackName.trim()
artistName = artistName.trim()
Spotify.addATrackToAPlaylist.setSearchQuery(trackName)
Spotify.addATrackToAPlaylist.setArtistName(artistName)
} else {
Spotify.addATrackToAPlaylist.skip()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment