Skip to content

Instantly share code, notes, and snippets.

@lukaszmn
Forked from gonza7aav/netflix-list-exporter.js
Last active February 10, 2022 15:08
Show Gist options
  • Save lukaszmn/3ad46fd6bd98062c5bad950af6df960a to your computer and use it in GitHub Desktop.
Save lukaszmn/3ad46fd6bd98062c5bad950af6df960a to your computer and use it in GitHub Desktop.
Netflix | This will download your list as a JSON file
/*
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