Last active
November 27, 2023 22:35
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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