请求LinkedIn的数据

发布于 2025-02-10 07:28:45 字数 1151 浏览 2 评论 0原文

我在从LinkedIn中刮擦数据有问题。
我认为文档太复杂了...
在这里,我想提出一个请求(获取)并获取例如我的提要/帖子/聊天或其他内容的数据。

这是我的代码:

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)

但我做不到,错误 - 错误 - - > 提高httperror(http_error_msg,wendesp = self)requests.exceptions.httperror:400客户端错误:URL的Inkapi错误:https://wwwwwwwww.linkedin.com/voyager/voyager/sentity/indetity/indity/indity/ddash/dash/dash/profiles

感谢您的帮助。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想你只要分分秒秒 2025-02-17 07:28:45

您只需要设置这样的标题:

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

,因此按照所需的端点填充有效载荷。
不必创建应用程序即可访问令牌或其他任何内容。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文