LinkedIn HTTP错误999 - 请求被拒绝

问题描述:

我正在编写一个简单的脚本,在LinkedIn上无需登录即可看到公开的个人档案。 下面是我的代码来获取美丽的页面。我也使用公共代理。LinkedIn HTTP错误999 - 请求被拒绝

import urllib.request, urllib.error 
from bs4 import BeautifulSoup 

url = "https://www.linkedin.com/company/amazon" 
proxy = urllib.request.ProxyHandler({'https': proxy, }) 
opener = urllib.request.build_opener(proxy) 
urllib.request.install_opener(opener) 
hdr = { 
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3218.0 Safari/537.36', 
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 
    'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 
    'Accept-Encoding': 'gzip, deflate, br', 
    'Accept-Language': 'en-US,en;q=0.9,hi;q=0.8', 
    'Connection': 'keep-alive'} 
req = urllib.request.Request(url, headers=hdr) 
page = urllib.request.urlopen(req, timeout=20) 
self.soup = BeautifulSoup(page.read(), "lxml") 

但它引发“HTTPError 999-请求被拒绝”错误。这只是为了测试目的,直到我通过合作伙伴计划获得访问权限。

我在做什么错?请帮忙。

你没有做错任何事,LinkedIn黑名单云服务器的IP地址,以防止“窃取”他们的数据。可疑的做法,但这是如何。