Skip to content

Instantly share code, notes, and snippets.

@rvighne
Last active November 27, 2023 22:35
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 rvighne/cb12f4d57ebb5a739ed5017021e8f85f to your computer and use it in GitHub Desktop.
Save rvighne/cb12f4d57ebb5a739ed5017021e8f85f to your computer and use it in GitHub Desktop.
Bookmarklet to scrape a list of titles on Justwatch into a CSV that can be imported into Letterboxd.
(function() {
// https://www.justwatch.com/us/lists/my-lists?content_type=movie&inner_tab=seenlist&list_layout=card
// https://www.justwatch.com/us/lists/my-lists?content_type=movie&inner_tab=watchlist&list_layout=card
// https://www.justwatch.com/us/lists/my-lists?content_type=movie&inner_tab=likelist&list_layout=card
// https://letterboxd.com/about/importing-data/
const total = parseInt(document.querySelector('.titles-count').textContent, 10)
const titles = document.getElementsByClassName('title-card-heading')
console.assert(titles.length === total, 'please scroll down until all titles are loaded')
return Array.prototype.reduce.call(
titles,
(csv, e) => `${csv}"${e.firstChild.wholeText.trim().replace('"', '\\"')}",${e.lastChild.firstChild.wholeText.match(/\d{4}/)[0]}\n`,
'Title,Year\n')
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment