Login to linkedin using python

python scraping

Home » Blog » Python » python scraping » Login to linkedin using python

LinkedIn needs login to access information inside it. If you are into data mining and wanted to scrape linkedin data then selenium could be the best choice but it comes with the trade-off for time. Instead we can use python requests module to login to the linkedin and scrape the data.

let’s import the requests module and for the parsing I am using the parsel (you can use bs4). Since a session has to be maintained while parsing the future, it got a pre-build session inside the requests.

Once we find the csrf , the login API needed the username, password and csrf token which needs to be send as the json

The data is passed to the login url and the data is passed. All the session will be saved inside the client and for the future all the links can be accessed directly with the ‘client.get(‘https://linkedinlink.com’)’ way.

The final code for the login is

About Author