Skip to content

Instantly share code, notes, and snippets.

@gonza7aav
Created May 1, 2021 08:46
Show Gist options
  • Save gonza7aav/84b886c4eeadfe26516fff9d13e4ddac to your computer and use it in GitHub Desktop.
Save gonza7aav/84b886c4eeadfe26516fff9d13e4ddac 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.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();
@lukaszmn
Copy link

@gonza7aav
Copy link
Author

@lukaszmn nice one! thanks for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment