crunchy-xml-decoder icon indicating copy to clipboard operation
crunchy-xml-decoder copied to clipboard

Can't login

Open Flwk opened this issue 9 years ago • 14 comments

Hello

I have an a premium account, but when i want to connect with the script i have this error : screenshot_1

What is the problem ?

Many Thanks

Flwk avatar Jan 20 '16 17:01 Flwk

https://github.com/einstein95/crunchy-xml-decoder/issues/50#issuecomment-170406596

danny-ml avatar Jan 21 '16 18:01 danny-ml

Hello @danny-ml

The fix of the #50 doesn't work now.

What's the problem @einstein95 ?

Many thanks in advance

Flwk avatar Mar 03 '16 16:03 Flwk

Change login.py line 20

old: site = session.get('https://www.crunchyroll.com/acct/membership/', headers=headers, verify=True).text

new: site = session.get('https://www.crunchyroll.com/acct/membership', headers=headers, verify=True).text

iCertys avatar May 22 '16 20:05 iCertys

The URL https://www.crunchyroll.com/acct/membership/ isn't working (404)

but without the "/" on the end it works

(sorry for my bad english)

Regards iCerty's

iCertys avatar May 22 '16 20:05 iCertys

Hello, I changed line 20 and still receive 'Login failed'. I am currently on a trial, will I be able to log-in after the trial period?

johnfigs avatar Jul 31 '16 08:07 johnfigs

I don't have a Trail Accont so I can't Test this. But there is one thing that you can check. Open your Browser and go to https://www.crunchyroll.com/acct/membership

Then view the SourceCode and search for dimension5

You should find something like this ga('set', 'dimension5', 'registered');

In the 'registered'); part is different send me this part and I will try to write a Fix for you.

Sorry for my bad english!

iCertys avatar Jul 31 '16 10:07 iCertys

*If the 'reg...

iCertys avatar Jul 31 '16 10:07 iCertys

iCertys, your english is very good! I looked at the source code and see the following:

ga('set', 'dimension5', 'freetrial'); ga('set', 'dimension6', 'premium');

Let me know if this is enough info. Thanks.

johnfigs avatar Jul 31 '16 18:07 johnfigs

Replace the entire code in login.py with these `import sys import re import requests import pickle from getpass import getpass

def getuserstatus(session=''): status = 'Guest' user1 = 'Guest' if session == '': session = requests.session() with open('cookies') as f: cookies = requests.utils.cookiejar_from_dict(pickle.load(f)) session = requests.session() session.cookies = cookies del session.cookies['c_visitor'] #print session.cookies #session = requests.session() headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0', 'Connection': 'keep-alive'} site = session.get('https://www.crunchyroll.com/acct/membership', headers=headers, verify=True).text #open('tempfile','w').write(site).encoding('UTF-8') #print site.encode('utf-8') if re.search(re.escape(' ga('set', 'dimension5', 'registered');'), site): status = 'Free Member' elif re.search(re.escape(' ga('set', 'dimension5', 'premium');'), site): if re.search(re.escape(' ga('set', 'dimension6', 'premiumplus');'), site): status = 'Premium+ Member' else: status = 'Premium Member' elif re.search(re.escape(' ga('set', 'dimension5', 'freetrail');'), site): status = 'Premium Member' if status != 'Guest': user1 = re.findall('<a href="/user/(.+)" ', site).pop() return [status,user1]

def login(username, password): headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0', 'Connection': 'keep-alive'} session = requests.session() session.get('http://www.crunchyroll.com/', headers=headers)

headers = {'Referer': 'https://www.crunchyroll.com/login',
           'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0',
           'Content-Type': 'application/x-www-form-urlencoded'}

payload = {'formname': 'RpcApiUser_Login', 'fail_url': 'http://www.crunchyroll.com/login',
           'name': username, 'password': password}
res = session.post('https://www.crunchyroll.com/?a=formhandler', data=payload, headers=headers).text
for c in session.cookies:
    c.expires = 9999999999  # Saturday, November 20th 2286, 17:46:39 (GMT)

del session.cookies['c_visitor']
del session.cookies['sess_id']

#headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0',
#           'Connection': 'keep-alive'}
#url = 'http://www.crunchyroll.com/'
#site = session.get(url, headers=headers).text
#print session.get('https://www.crunchyroll.com/acct/membership/', headers=headers, verify=True).text.encode('utf-8')
#print getuserstatus(session)
#if re.search(username+'(?i)', site):
#    if username == '':
#        print 'Login as Guest.'
#    else:
#        print 'Login successful.'
#    pickle.dump(requests.utils.dict_from_cookiejar(session.cookies), open('cookies', 'w'))
#    with open('cookies', 'w') as f:
#        pickle.dump(requests.utils.dict_from_cookiejar(session.cookies), f)
#else:
#    print 'Login failed.'
#    sys.exit()
userstatus = getuserstatus(session)
if username != '' and userstatus[1] == 'Guest':
    print 'Login failed.'
    sys.exit()
else:
    print 'Login as '+userstatus[0]+' successfully.'
    pickle.dump(requests.utils.dict_from_cookiejar(session.cookies), open('cookies', 'w'))
    with open('cookies', 'w') as f:
        pickle.dump(requests.utils.dict_from_cookiejar(session.cookies), f) 

if name == 'main': try: if sys.argv[1][0] == 'y': username = raw_input(u'Username: ') password = getpass('Password(don't worry the password are typing but hidden:') except IndexError: username = '' password = '' login(username, password)`

iCertys avatar Jul 31 '16 20:07 iCertys

with out the ` at the start and at the end. I don't know why they are there.

If you are interested in what I have changed, i added this after line 29:

elif re.search(re.escape(' ga('set', 'dimension5', 'freetrail');'), site): status = 'Premium Member'

iCertys avatar Jul 31 '16 20:07 iCertys

that worked by changing the line to 'elif re.search(re.escape(' ga('set', 'dimension5', 'freetrail');'), site): status = 'Premium Member''

Thank You!

johnfigs avatar Jul 31 '16 22:07 johnfigs

not work in my case, what line i have to change? :(

Dokman avatar Sep 09 '16 11:09 Dokman

@Dokman can you please Post your error Output and Information about Premium or Premium+ or Free or Trail or DayPass Member.

iCertys avatar Sep 09 '16 13:09 iCertys

#78 includes the changes for dealing with the new login mechanism. I haven't tried non-premium, so YMMV.

jsonn avatar Sep 15 '16 16:09 jsonn