Skip to content

Instantly share code, notes, and snippets.

@AglaianWoman
Forked from plasx/linkedin.py
Created January 28, 2018 07:38
Show Gist options
  • Save AglaianWoman/dee4fe7c3d5474544b53f7eb090df3a7 to your computer and use it in GitHub Desktop.
Save AglaianWoman/dee4fe7c3d5474544b53f7eb090df3a7 to your computer and use it in GitHub Desktop.
linkedin login bs4
import requests
from bs4 import BeautifulSoup
client = requests.Session()
HOMEPAGE_URL = 'https://www.linkedin.com?allowUnsupportedBrowser=true'
LOGIN_URL = 'https://www.linkedin.com/uas/login-submit?allowUnsupportedBrowser=true'
html = client.get(HOMEPAGE_URL).content
soup = BeautifulSoup(html)
csrf = soup.find(id="loginCsrfParam-login")['value']
login_information = {
'session_key':'username',
'session_password':'password!',
'loginCsrfParam': csrf,
}
client.post(LOGIN_URL, data=login_information)
x = client.get('http://www.linkedin.com/messaging/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment