spinlud / linkedin-jobs-scraper

151 stars 41 forks source link

Help with getting Authenticated Session #35

Closed amoiza1 closed 2 years ago

amoiza1 commented 2 years ago

Can anyone please help me, I have spent 3 days on this and getting to the point of exhaustion.

I have not been able to run authenticated session. I retrieved li_at cookie from chrome but cannot set the li_at environment variable of chrome. I have tried using set li_at = 'xxx' in command prompt but it doesn't work, I even added chrome in my path. Do I need to assign cookie in the code too, I see there is a chrome_cdp class but I don't know how to use it?

Would really appreciate if someone can please help on this? I have just not been able to run authenticated session.

amoiza1 commented 2 years ago

Posting in py_linkedin_jobs_scraper as I am working in python

spinlud commented 2 years ago

Hi, you just need to set the env variable LI_AT_COOKIE with the value of the cookie you get from the Linkedin website. If you are running your python script from command line, you can use the following:

LI_AT_COOKIE="your_cookie_value_here" python your_script_name.py

You can easily check if your env variable is set from within your python script:

import os

print os.environ['LI_AT_COOKIE']