用python+chromedriver 爬取网站商品页面时,遇到403问题
这个该怎么修改才能够正常显示商品页面啊??
但是如果访问网站首页,代码可以正常运行。
import time
from pathlib import Path
from anti_useragent import UserAgent
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
options = Options()
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("--disable-extensions")
options.add_argument("--disable-features=Translate")
options.add_argument("--disable-popup-blocking")
# options.add_argument("--headless=new")
options.add_argument("--hide-scrollbars")
options.add_argument("--ignore-certificate-errors")
options.add_argument("--incognito")
options.add_argument("--mute-audio")
options.add_argument("--no-default-browser-check")
options.add_argument("--propagate-iph-for-testing")
options.add_argument("--start-maximized")
options.add_argument("--user-agent=" + UserAgent("windows").chrome)
options.add_argument("--window-position=100,100")
options.add_argument("--window-size=1600,1024")
options.add_experimental_option("excludeSwitches", ["enable-automation", "enable-logging"])
service = Service()
driver = webdriver.Chrome(service=service, options=options)
s=driver.get('https://iyec.itoyokado.co.jp/front/commodity/0004/00018944/')
time.sleep(20)
driver.quit()
显示的是
<html style="height:100%"><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><meta name="format-detection" content="telephone=no"><meta name="viewport" content="initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><script type="text/javascript" src="/_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3"></script><script src="/oid-our-hope-it-my-then-good-Recomfor-the-digge-" async></script></head><body style="margin:0px;height:100%"><iframe id="main-iframe" src="/_Incapsula_Resource?CWUDNSAI=23&xinfo=4-45362685-0%20NNNN%20RT%281700390988954%209%29%20q%280%20-1%20-1%202%29%20r%280%20-1%29%20B15%2814%2c0%2c0%29%20U24&incident_id=433001140076330935-262689854938225796&edet=15&cinfo=0e00000072a6&rpinfo=0&cip=115.163.85.169&mth=GET" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 433001140076330935-262689854938225796</iframe></body></html>