Skip to content

Instantly share code, notes, and snippets.

@eheikes
Last active May 27, 2018 16:50
Show Gist options
  • Save eheikes/e2535866206b0fdab7f5 to your computer and use it in GitHub Desktop.
Save eheikes/e2535866206b0fdab7f5 to your computer and use it in GitHub Desktop.
Opens a Pitchfork album review in Amazon for music previewing
(function(){
var artist = document.querySelector('.artist-links').textContent;
var album = document.querySelector('.single-album-tombstone__review-title').textContent;
var searchString = artist + ' ' + album;
var encoded = encodeURIComponent(searchString.replace(/\bep\b/gi, '')).replace(/ /g, '+');
var url = 'http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Ddigital-music&field-keywords=' + encoded;
window.open(url, 'mp3search');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment