Created
May 1, 2021 08:46
-
-
Save gonza7aav/84b886c4eeadfe26516fff9d13e4ddac 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.getElementsByClassName('watch-title')]; | |
return cards.map((el) => { | |
const id = el.href.slice(el.href.indexOf('/title/') + 7); | |
const name = el.ariaLabel; | |
return { id, name }; | |
}); | |
}; | |
const saveFile = async () => { | |
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
Not working now - fixed in https://gist.github.com/lukaszmn/3ad46fd6bd98062c5bad950af6df960a