Skip to content

Instantly share code, notes, and snippets.

@alana314
Last active April 19, 2024 00:49
Show Gist options
  • Save alana314/6bdc9af962fd8620a4fb to your computer and use it in GitHub Desktop.
Save alana314/6bdc9af962fd8620a4fb to your computer and use it in GitHub Desktop.
//Now with less jquery
//1) go to your my-list page, and scroll to the bottom to make sure it's all loaded:
//http://www.netflix.com/browse/my-list
//2) Next, paste this in your developer tools console and hit enter:
[...document.querySelectorAll('.slider [aria-label]')].map(ele => ele.getAttribute('aria-label'))
//or use this to copy the list to your clipboard:
copy([...document.querySelectorAll('.slider [aria-label]')].map(ele => ele.getAttribute('aria-label')))
@agwosdz
Copy link

agwosdz commented Sep 5, 2020

Thanks! I could export all titles and then I had to figure out how to add them to my new profile.
Found a very patchy way but did the job. Hope someone will need this.

1. Login & Select your old Account -> Profile
2. Go to My List (old profile)
3. Run this code in your Browser Developer console to Export and save My List

var tmpList = (function() {
    var list = []
    document.querySelectorAll('.title-card a[aria-label]').forEach(
        function(item) {
            try {
                list.push({
                    name: item.getAttribute('aria-label'),
                    link: ("https://www.netflix.com" + item.getAttribute("href").split("?")[0]).replace('watch', 'title')
                })
            } catch (err) {
                console.error("ERROR: Ignored err", err, item)
            }
        })
    return (JSON.stringify(list));
}());
localStorage.setItem('tmpList',tmpList);

4. Logout old account
5. Login & Select your new Account -> Profile
6. Run this Code in your Browser Developer console to Import My List saved in step 3

(function(){
  var list = JSON.parse(localStorage.getItem('tmpList'))
  var counter = 0;
  function openWin(e){
    var popup;
    popup = window.open(list[e].link);
    popup.onload = function(){
      setTimeout(function(){
        if(popup.document.querySelector('.nf-flat-button-icon-mylist-add + span')){
          popup.document.querySelector('.nf-flat-button-icon-mylist-add + span').click();
          setTimeout(function(){popup.close()}, 500);
          console.log('Added', list[e].name);
        } else {
          popup.close();
          console.log('Already added', list[e].name);
        }
      }, 500)
    }
    var timer = setInterval(function() { 
      if(popup && popup.closed) {
        clearInterval(timer);
        if(list.length-1 > counter){
          openWin(++counter);
        } else {
          console.log('Added');
          localStorage.removeItem('tmpList');
        }
      }
    }, 1000);
  }
  openWin(counter)
}())

7. Done

Thanks, but the code is not working for me.... Getting a cannot set property 'onload' of null

Any ideas?

@mmcmaster-au
Copy link

The exporting script worked for me, but I had issues with the importing script.

The Chrome popup blocker needs to be disabled while importing.
Settings -> Site Settings -> Popups and Redirects

Second, I modified the code as follows:

(function(){
  var list = JSON.parse(localStorage.getItem('tmpList'))
  var counter = 0;
  function openWin(e){
    var popup;
    popup = window.open(list[e].link);
    popup.onload = function(){
      setTimeout(function(){
        if(popup.document.querySelector('[data-uia="add-to-my-list"]')){
          popup.document.querySelector('[data-uia="add-to-my-list"]').click();
          setTimeout(function(){popup.close()}, 500);
          console.log('Added', list[e].name);
        } else {
          popup.close();
          console.log('Already added', list[e].name);
        }
      }, 500)
    }
    var timer = setInterval(function() { 
      if(popup && popup.closed) {
        clearInterval(timer);
        if(list.length-1 > counter){
          openWin(++counter);
        } else {
          console.log('Added');
          localStorage.removeItem('tmpList');
        }
      }
    }, 1000);
  }
  openWin(counter)
}())

@m1337v
Copy link

m1337v commented Jan 2, 2021

Does anyone have an idea how to hide movies if they are either upvoted or downvoted? I only have a solution for downvotes if they are "greyed out". Maybe one could combine the scripts from here with this one?

    // ==/UserScript==
var $ = window.jQuery;
setInterval(function(){
        $('.slider-item:has(.is-disliked)').remove();
}, 1000);

@dwhitz
Copy link

dwhitz commented Sep 3, 2022

I suggest to take a look to https://github.com/origamiofficial/docker-netflix-migrate for exporting and importing netflix ratings

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