Skip to content

Instantly share code, notes, and snippets.

@andydavies
Forked from johnmurch/keywordsFromUrl.js
Created July 27, 2020 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andydavies/209f4510f424c57aa3172bd2335dd4a7 to your computer and use it in GitHub Desktop.
Save andydavies/209f4510f424c57aa3172bd2335dd4a7 to your computer and use it in GitHub Desktop.
Parse keywords from URL
let url = "https://www.amazon.com/SanDisk-128GB-microSDXC-Memory-Adapter/dp/B073JYC4XM/";
let kwparse = (url.replace('https://','').replace('http://','').replace('www','').replace('com','').split('-').join().split('/').join().split('.')).join(',').replace(/^,/, '')
let kwuniq = [...new Set(kwparse.split(','))].filter(function(e){return e});
console.log(kwuniq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment