fix logUsingCookie

* it seems that the site only cares about the cookie `session_id`
* when checking if the user is authenticated the cookie jar was not being used
This commit is contained in:
elisha464 2019-11-30 16:32:24 +02:00 committed by GitHub
parent 1555229635
commit fa4c68c239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,7 +110,7 @@ function checkIfUserIsAuth(config: IConfig, done: (err: Error) => void): void
*/ */
const url = 'http://www.crunchyroll.com/'; const url = 'http://www.crunchyroll.com/';
cloudscraper.get({gzip: true, uri: url}, (err: Error, rep: string, body: string) => cloudscraper.get({gzip: true, uri: url, jar: j}, (err: Error, rep: string, body: string) =>
{ {
if (err) if (err)
{ {
@ -338,9 +338,7 @@ function authenticate(config: IConfig, done: (err: Error) => void)
} }
else if (config.logUsingCookie) else if (config.logUsingCookie)
{ {
j.setCookie(request.cookie('c_userid=' + config.crUserId + '; Domain=crunchyroll.com; HttpOnly; hostOnly=false;'), j.setCookie(request.cookie('session_id=' + config.crSessionId + '; Domain=crunchyroll.com; HttpOnly; hostOnly=false;'),
CR_COOKIE_DOMAIN);
j.setCookie(request.cookie('c_userkey=' + config.crUserKey + '; Domain=crunchyroll.com; HttpOnly; hostOnly=false;'),
CR_COOKIE_DOMAIN); CR_COOKIE_DOMAIN);
checkIfUserIsAuth(config, (errCheckAuth2) => checkIfUserIsAuth(config, (errCheckAuth2) =>