L
L
LordOftheCode2021-10-20 11:14:22
Python
LordOftheCode, 2021-10-20 11:14:22

How to fix python json decoding?

I get such an error when decoding json format 616fcf8b2ff11803660966.png

code where an error pops up

def parseCookie(cookies):
    everything = json.loads(cookies)
    result = ''
    for i in everything:
        if i['name'] != 'df_id':
            result = result + i['name'] + '=' + i['value'] + '; '
        else:
            response = requests.get('https://lolz.guru/process-qv9ypsgmv9.js', headers={
                'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36'}, proxies=PROXYES).text.split(
                '[')[1].split(']')[0].replace('\'', '').replace('+', '').split(',')[-1]
            df_id = str(base64.b64decode(str(response)))[2:-1]
            result = result + i['name'] + '=' + str(df_id) + '; '

    return result[:-1]



f = open('cookies.txt', 'r' ,encoding='utf-8')
cookies = parseCookie(f.read())


namely in these lines

everything = json.loads(cookies)

f = open('cookies.txt', 'r' ,encoding='utf-8')
cookies = parseCookie(f.read())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-10-20
@LordOftheCode

This means that the JSON in the cookies.txt file is not correct. Perhaps it is completely empty?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question