网页抓取/网页抓取在我要抓取的网站上显示 403 错误
web scraping / web crawling showing 403 error on the site i want to crawl
import requests
from bs4 import BeautifulSoup
url ='https://www.vesselfinder.com/vessels'
headers= {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)'}
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
response.status_code
我尝试了不同的用户代理但仍然无法正常工作,我尝试了其他可以正常工作的网站但该网站无法正常工作,请帮助我从该网站抓取所有船只数据。提前致谢!!!
服务器需要额外的 header 语言
import requests
headers = {
'user-agent': 'Mozilla/5.0',
'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
}
response = requests.get('https://www.vesselfinder.com/vessels', headers=headers)
response.status_code
import requests
from bs4 import BeautifulSoup
url ='https://www.vesselfinder.com/vessels'
headers= {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)'}
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
response.status_code
我尝试了不同的用户代理但仍然无法正常工作,我尝试了其他可以正常工作的网站但该网站无法正常工作,请帮助我从该网站抓取所有船只数据。提前致谢!!!
服务器需要额外的 header 语言
import requests
headers = {
'user-agent': 'Mozilla/5.0',
'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
}
response = requests.get('https://www.vesselfinder.com/vessels', headers=headers)
response.status_code