Forked from gonza7aav/netflix-list-exporter.js
Last active
February 10, 2022 15:08
-
-
Save lukaszmn/3ad46fd6bd98062c5bad950af6df960a to your computer and use it in GitHub Desktop.
Netflix | This will download your list as a JSON file
This file contains 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
/* | |
Netflix - List Exporter | |
This will download your list as a JSON file | |
*/ | |
/* | |
🚀 Usage | |
1. Go to Netflix | |
2. Go to your List | |
3. Open the browser console | |
4. Reload page (to activate mobile page) | |
5. Go down until no more movies load | |
6. Paste this | |
7. DONE! | |
*/ | |
const getMovies = () => { | |
const cards = [...document.querySelectorAll('.title-card .slider-refocus')]; | |
return cards.map((el, index) => { | |
const link = el.href.replace(/\?.*/, ''); | |
const name = el.ariaLabel; | |
return { link, name, index: index + 1 }; | |
}); | |
}; | |
const saveFile = async () => { | |
const json = JSON.stringify(getMovies(), null, 2) | |
console.log(json); | |
const blob = new Blob([JSON.stringify(getMovies(), null, 2)], { | |
type: 'application/json', | |
}); | |
const url = URL.createObjectURL(blob); | |
let a = document.createElement('a'); | |
document.body.appendChild(a); | |
a.style = 'display: none'; | |
a.href = url; | |
a.download = 'netflix_list'; | |
a.click(); | |
window.URL.revokeObjectURL(url); | |
a.remove(); | |
}; | |
saveFile(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment