Home > Mobile >  Request data from Linkedin
Request data from Linkedin

Time:07-03

I have Problem with scraping data from LinkedIn.
I think the documentation is too complicated ...
here the problem, I want to make a request (GET) and get for example data of my feed/posts/chats or whatever.

here is my code:

import json 
import requests


# URL = "https://www.linkedin.com/voyager/api/voyagerMessagingDashConversationNudges"
URL = "https://www.linkedin.com/voyager/api/identity/dash/profiles"

cookies = {
   #Cookies are here
}

params = {
    'decorationId': 'com.linkedin.voyager.dash.deco.identity.profile.WebTopCardCore-6',
    'memberIdentity': 'maria-albert-137632240',
    'q': 'memberIdentity',
}

def get_group(url: str, cookies: dict, data:dict, header: dict):
    response = requests.get(url=url, cookies=cookies, data=json.dumps(data), headers=header)
    response.raise_for_status()
    return response.json()

if __name__ == "__main__":
    print("sending request to Server:\n")
    get_group(url=URL, cookies=cookies, data=params, header=headers)

but I couldn't do it, the error --> raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: INKApi Error for url: https://www.linkedin.com/voyager/api/identity/dash/profiles

Thanks for your help.

CodePudding user response:

You just need to set header like this:

header = {
    "accept": 'application/vnd.linkedin.normalized json 2.1',
    "cookie": 'JSESSIONID="ajax:abcd"; li_at=abcdabcd',
}

and so fill the payload as the endpoint needed.
You don't have to Create App to access token or anything else.

  • Related