我正试图通过使用请求库登录linkedin。在环顾了这一点的最佳方法之后,我尝试使用^{cd1>}来完成这一点,但我没有成功。 我相信这与我发到的链接有关。
import requests
payload = {
'session_key': EMAIL_GOES_HERE,
'session_password': PASSWORD_GOES_HERE
}
with requests.Session() as s:
s.post('https://www.linkedin.com/', data=payload)
#program should be signed in here so I am going onto a private page that requeires the user to be signed in.
r=s.get('https://www.linkedin.com/vsearch/p?f_CC=2289109')
#saving the results in an HTML file for easy debugging/viewing
html= open('testtest.html', 'w')
html.write(r.content)
html.close()
我应该首先说明您确实应该使用他们的API: http://developer.linkedin.com/apis
在linkedin的首页上似乎没有使用这些参数的POST登录?在
这是您必须发布到的登录URL: https://www.linkedin.com/uas/login-submit
请注意,这可能也不起作用,因为您至少需要登录表单中的csrfToken参数。在
您可能还需要loginCsrfParam,也可以从frontpage的登录表单中获取。在
像这样的事情也许会奏效。未经测试,您可能需要添加其他POST参数。在
相关问题 更多 >
编程相关推荐