LBBO / netflix-migrate

A command-line tool to migrate data to and from Netflix profiles
MIT License
266 stars 32 forks source link

Type error because memberContext ist undefined #37

Closed benthillerkus closed 1 year ago

benthillerkus commented 5 years ago

No matter what I do, I get the error message: image

argoolsbee commented 5 years ago

I got this same error, and found it was because I was putting the wrong Netflix password for the account at the prompt.

LBBO commented 5 years ago

Precicely what @argoolsbee said. I can reproduce this error by entering incorrect login information but with the correct information, everything works just fine. ~If you'd like, you can open an issue in @LBBO/node-netflix2 so that wrong login data throws its own error.~ Edit: I just noticed that that issue already exists: https://github.com/LBBO/node-netflix2/issues/20

Please check your login data and close this issue if that fixed it.

benthillerkus commented 5 years ago

Well my Login data was definitely correct, because I tried it multiple times either by handtyping or copy pasting the password. Maybe the issue is that the profile I tried to access has space characters?

argoolsbee commented 5 years ago

I can't find it now, but I remember seeing the same error could occur if the Netflix subscription was inactive.

In any case, it seems this error is ultimately because the netflix2 API was unable to authenticate with Netflix for some reason.

LBBO commented 5 years ago

@argoolsbee you are probably referring to #24 and yes, an inactive account would probably cause this exact or a very similar error message. As I don't have an inactive account, I can't check that.

@ogierm If your profile name includes a space, you can just surround it with quote marks like so:

netflix-migrate --email your@email.com --profile "Your profile name" --export netflixData.json

However, the problem is your actual login (with email and password). If the login had completed, the script would have logged Switching to profile Thorsten. Since it didn't the crash happened during login. Does your password contain any characters that might confuse the power shell? I'm especially thinking of quotation marks or backslashes. If it does, could you try escaping them?

Also, could you try logging in to your account with your browser using the exact same data? If that doesn't work, netflix-migrate won't be able to login either.

benthillerkus commented 5 years ago

I can login with the data it is definitely correct (I have to login per hand each time I open Netflix on my TV, because it constantly "forgets" the session)

Since I already deleted the profile data and started a new one, I haven't touched the tool after writing the issue.

I guess I'll expand a bit on the situation I had. Basically my profile was the first profile on the account. We wanted to use Netflix on the TV, but the Netflix App on the TV doesn't support profiles, it will just use the first one that is in the account (the TV is from 2012) so I had to basically give up my profile and start a new one. I wanted to use the tool to move over some data to my new profile. I renamed my old profile to "Thorsten der TV" and added a new profile which had the name of my old profile. Besides the spaces the names didn't use any crazy characters. I assumed the spaces were a problem so I tried wrapping it with quotation marks, only using the first word before the space etc. Basically everything you do when troubleshooting.

To be honest I don't really have a use case for this anymore so yeah. If you want me to test something specific I can do that, but beyond that I don't need it to work anymore.

ishefi commented 4 years ago

I get this error as well. I'm sure credentials are correct. My account is deactivated though (doesn't happen for an activated account)

KevinAlexandro commented 4 years ago

Has the issue been fixed? Let me know if I can help.

LBBO commented 4 years ago

@KevinAlexandro I don't think so, as I haven't been able to reproduce the issue. Is there anything special about your account (such as unusual characters or the account being deactivated) and have you double-checked for correct spelling? I guess, any additional information that could help me reproduce this issue would help!

KevinAlexandro commented 4 years ago

I am trying to migrate between an account that will be inactive on Monday and another one which is active. Also, I tried to migrate the other way around but I got the same error when the login takes place. I get the following error:

netflixMigrateError

I thought that the issue was related with the netflix2 version so I tried updating with the latest available version I found, but the issue persisted. Then I tried with another OS (Ubuntu 20LTS and Windows 10), but the issue persisted.

Is there any chance I need an old version of netflix2, the one used when migrate Netflix was released?

LBBO commented 4 years ago

First of all, sorry for taking so long to get back to you. I really hope you didn't loose your account's data because of this!

After doing some research, I was able to consistently reproduce the following behavior:

  1. Use netflix-migrate in some way with correct login data. This command will succeed
  2. Execute any other netflix-migrate command (even the exact same command as in 1) and it will fail.

The problem might be that Netflix doesn't allow two sessions from the same network. If I wait a few minutes after the successful command, I can execute another command successfully and the command after that will fail again (if I don't wait long enough). This might be fixable by logging off after every command, but I haven't gotten to that yet.

@KevinAlexandro and @jn-harvey (from #46): did your errors occur after running netflix-migrate once successfully? Perhaps the export worked, but then the import didn't work. And if so, could you try the import again and see if it works?

LBBO commented 4 years ago

It's also worth noting that you can't have an open tab with Netflix while using netflix-migrate. That's definitely something I will add to the README

pinkbunny1 commented 4 years ago

I could log in to the Netflix account successfully and had everything closed and executed the command but I have the same error message.

LBBO commented 4 years ago

Ok, after doing some more experimentation, my current guess is that Google reCAPTCHA is stopping most (but not all) login attempts. Here's why I think that:

  1. I just cannot for the life of me reproduce this issue consistently. Without changing any code at all (or anything else, for that matter - I just leave my computer for a few minutes), some requests go through and some fail.
  2. After checking archive.org, it looks like Netflix added Google reCAPTCHA around Feb 27 2020, which roughly coincides with this issue gaining traction. It was opened in 2019, but it seems to have gotten way more common now and I also wasn't able to reproduce it back then.

I'm not really sure how to confirm this theory (please feel free to share any ideas you might have on that!). And even if I was able to confirm it, I have no idea how to get around Google's reCAPTCHA. One option might be to have the user enter their authUrl from an active browser session, but that would be a pretty terrible UX.

For now, all I can suggest is trying it again. Perhaps wait a few minutes in between requests, maybe even a day, I just don't know. Please let me know how things go, though!

eva-m-nl commented 3 years ago

I have the same issue running Ubuntu in WSL2. ill try to check after some time, maybe in an hour or in a day.

shivaramg commented 3 years ago

I was able to export the data fine but I get the error when I import. I made sure that the password is correct. May be I will wait for a day or two and try since I just created my netflix account

dstronczak commented 3 years ago

Got the very same issue. Export works fine, but I get the very same error every time I import. So far I tried:

EDIT: Actually to be clear:

dstronczak commented 3 years ago

@LBBO I really care about solving this issue, if you could suggest some ways of debugging the problem (like manually sending request to a specific endpoint to get more descriptive error) I could try to do some investigation myself. I'd really appreciate that :)

LBBO commented 3 years ago

Hey @dstronczak!

Sorry for not getting back to you for a while. To be honest, I haven't looked into this issue for a while, so I might be forgetting details or my information might be outdated.

One thing you could do is to compare the Netflix response to responses from other sites that use reCAPTCHA. This way, we might be able to confirm that reCAPTCHA is actually the source of this issue.

As for other ideas: it might be possible to create a browser plugin (or even a bookmarklet?) that either brings this plugin's functionality to the browser or transmits any necessary data to the command line tool. Turning this project into a plugin actually makes a lot of sense, especially in terms of the UI. The user could then just log in on their own and the plugin would then execute pretty much the same scripts, I think. There might be issues with limitations for plugin's network traffic, though.

There are more important things for me to take care of in the next weeks and months, so it might take a while before I get around to looking into this change, though. I wouldn't expect it to happen before March.

laithsaid commented 3 years ago

Is it possible to access the API by other means and give the correct reCAPTCHA?

ncesar commented 3 years ago

same problem here, I was able to export but when I tried to import i got undefined :( going to wait a few hours to try again

pedroluisneves commented 3 years ago

I´m facing the same issue. Some how I was able to export, however after many tries, but import seams to be impossible. Is there any way to edit netflix2.js to manually add a valid token after the browser login?

LBBO commented 3 years ago

Hey everyone!

I really like the idea of manually logging in and then just adding some token as a parameter. I will look into it these next days and will get back to you once I have an update.

LBBO commented 3 years ago

Alright, I have a working prototype!

Netflix-migrate will no longer email address and username. Instead, users must manually log in to Netflix, open the console, and copy the cookie by running document.cookie. That value will then have to be provided to netflix-migrate and everything should work (at least, it does for me).

Let me turn this into something actually usable (instead of hard-coding the cookie 😅 etc.) and then a beta version will be on its way.

LBBO commented 3 years ago

Hey everyone,

I just published a beta version that should fix this issue! You can install it with npm i netflix-migrate@beta or run it directly with npx netflix-migrate@beta .... However, please be aware that the rest of the commands have changed. For more information on that, please refer to the README I linked below.

Sadly, I was wrong about how the cookie could be extracted. Apparently, a part of the cookie is needed that cannot be extracted via JS, which I accidentally missed last evening. The cookie must, instead, be extracted from the network tab, which is a bit more complicated. I wrote some instructions on how to do this, though. You can find them in the README of the branch I'm currently working on.

If you'd like to, please feel free to give this a try and leave some feedback in #54 if you run into any trouble or if you find the instructions to be unclear in any way.

weq commented 3 years ago

Hi, I tried out the beta and it is bugging over import due to several reasons it seems. At first it bugs out because of the version number in the JSON. Tried to edit that to 0.3.6 and it moves a bit forward but it halts here:

npx: installed 146 in 8.822s
Using new Netflix2 class!
Logging into Netflix using Cookies
Login successful!
Switching to profile Hilde
Successfully switched profile!
Reading data from hilde3_netflix.json
Found rating history and viewing history
Setting rating for The White Tiger: thumbs up
TypeError: Request with GET/HEAD method cannot have body
    at new Request (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\node-fetch\lib\index.js:1199:10)
    at C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\node-fetch\lib\index.js:1409:19
    at new Promise (<anonymous>)
    at fetch (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\node-fetch\lib\index.js:1407:9)
    at Netflix.__request (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\netflix2\lib\netflix2.js:58:18)
    at Netflix.__apiRequest (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\netflix2\lib\netflix2.js:501:35)
    at Netflix.__setRating (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\netflix2\lib\netflix2.js:355:35)
    at Netflix.setThumbRating (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\netflix2\lib\netflix2.js:381:16)
    at C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\main.js:255:19
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
Error: There was something wrong with your request. For more information, see previous log statements.
    at Netflix.__apiRequest (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\netflix2\lib\netflix2.js:509:13)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async Netflix.__setRating (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\netflix2\lib\netflix2.js:355:24)
    at async Netflix.setThumbRating (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\netflix2\lib\netflix2.js:381:5)
    at async C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\main.js:255:5
    at async main (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\main.js:51:4)
Error: Couldn't set thumb rating. For more information, see previous log statements.
    at Netflix.__setRating (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\netflix2\lib\netflix2.js:362:13)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async Netflix.setThumbRating (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\node_modules\netflix2\lib\netflix2.js:381:5)
    at async C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\main.js:255:5
    at async main (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\main.js:51:4)
Error: Could not set thumb rating for The White Tiger. For more information, please see previous log statements.
    at C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\main.js:263:10
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async main (C:\Users\micro\AppData\Roaming\npm-cache\_npx\21008\node_modules\netflix-migrate\main.js:51:4)
loiu92 commented 3 years ago

memberContext seems to be renamed to loginContext. I can make the login working by changing memberContent to loginContext but then i have an issue about profile guid

StevieApp commented 2 years ago

I'm trying to use the cookie from my account on netflix2 and email and password on netflix-migrate and I'm receiving the same issue Cannot read property 'data' of undefined

StevieApp commented 2 years ago

memberContext seems to be renamed to loginContext. I can make the login working by changing memberContent to loginContext but then i have an issue about profile guid

If this is the issue then the netflix2 part is the issue

card13 commented 2 years ago

Getting same error with master branch. Did lots of reading, about to download and try https://github.com/LBBO/netflix-migrate/tree/cookie-login.

EDIT Tried the cookie ver and got the output of (log file attached): card13@justin-laptop:~/Downloads/netflix-migrate-cookie-login$ npx netflix-migrate --cookie "" --profile Justin --import ~/Downloads/Data.json Need to install the following packages: netflix-migrate Ok to proceed? (y) y npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 error: unknown option `--cookie' npm ERR! code 1 npm ERR! path /home/card13/Downloads/netflix-migrate-cookie-login npm ERR! command failed npm ERR! command sh -c netflix-migrate "--cookie" "" "--profile" "Justin" "--import" "/home/card13/Downloads/Data.json"

npm ERR! A complete log of this run can be found in: npm ERR! /home/card13/.npm/_logs/2021-11-08T01_08_07_363Z-debug.log 2021-11-08T01_08_07_363Z-debug.log

EDIT Found the cause of my issue. I did a fresh install of npm on my Windows Desktop and all went well, but my Ubuntu Laptop was still not functional.

seabird commented 1 year ago

OK, so is the solution for the import: use another computer? Don't have a 4K account? Have a simple profile name?

Or is it just open and not solved yet?

I would love to transfer my old profile to my new account

seabird commented 1 year ago

OK, so is the solution for the import: use another computer? Don't have a 4K account? Have a simple profile name?

Or is it just open and not solved yet?

I would love to transfer my old profile to my new account

OK, so I tried again, but this time a clean install from my debian server. Same result. So I shortened the command and simplified my password. To my surprise: import worked.

Unfortunately as indicated in the read me: only ratings were imported (as far as I can tell). Viewed or lists remain pending.

Hoping there is a update for this in the near future.

For.information: profile name was the same and new profile is a 4K account.

LBBO commented 1 year ago

Since Netflix added native support for account transfer (including viewing history and My List 🎉), I'm archiving this project (see #73). Please refer to their official documentation if you still need to transfer you account data.