我使用下面的代碼嘗試抓取頁面中的鏈接,但似乎這種方法不能讓我登錄,只是告訴我未經授權的主頁。我如何使用python-request獲取linkedin頁面?
#/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
payload = {
'session-key': 'my account',
'session-password': 'my password'
}
URL = 'https://www.linkedin.com/uas/login'
s = requests.session()
s.post(URL, data=payload)
r = s.get('http://www.linkedin.com/nhome')
soup = BeautifulSoup(r.text)
print(soup)
`
檢查。 http://stackoverflow.com/questions/12751293/how-to-use-python-to-retrieve-xml-page-that-requires-http-login –
@ m170897017那不適合LinkedIn的情況下,你可以試試那麼給我正確的代碼? – leafonsword