跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 求助: selenium chrome 模拟真实请求 DHL 跟踪数据返回 Access Denied 怎么破?使用随机代理+随机 UA 仍然不行
未分類
30 1 月 2022

求助: selenium chrome 模拟真实请求 DHL 跟踪数据返回 Access Denied 怎么破?使用随机代理+随机 UA 仍然不行

求助: selenium chrome 模拟真实请求 DHL 跟踪数据返回 Access Denied 怎么破?使用随机代理+随机 UA 仍然不行

資深大佬 : yasea 16

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument(‘–disable-gpu’)# win 必须使用该选项
chrome_options.add_argument(‘log-level=2’)#屏蔽日志
chrome_options.add_argument(‘–disable-software-rasterizer’)
chrome_options.add_argument(“–disable-extensions”)
chrome_options.add_argument(‘–disable-logging’)
chrome_options.add_argument(‘–ignore-certificate-errors’)
chrome_options.add_argument(‘–ignore-ssl-errors’)
chrome_options.add_argument(‘–no-sandbox’)
chrome_options.add_argument(“–window-size=1220,800”)
chrome_options.add_argument(‘user-agent=’ + spider_utils.get_ua())
chrome_options.add_argument(‘–proxy-server={0}’.format(proxy_ip))
prefs = {
‘profile.default_content_setting_values’ : {
‘notifications’ : 2
}
}
chrome_options.add_experimental_option(‘prefs’,prefs)
前几个月是能正常工作的, 最近不好使了, 有经验的朋友,请帮忙瞅瞅
大佬有話說 (3)

  • 主 資深大佬 : yasea

    补充一下,写爬虫的主要目的是对物流单号的 DHL 跟踪数据批量截图保存,因为官方只支持查询近 3 个月的数据。

  • 資深大佬 : dicc

    add_argument data-dir 这个目录指向你 chrome 真实的数据目录

  • 主 資深大佬 : yasea

    @dicc 谢谢,中午测试了下, 依然被反爬了,有时候返回 Access Denied , 有时候返回这个:
    Your tracking attempt has been blocked
    Please note that the tracking status information on this website is intended for human consumption via the website only. It is not intended to be used for integration with your systems. Automated extraction of information by bots, website scraping etc. is prohibited.

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具