iT邦幫忙

0

selenium爬蟲爬不到資料

https://www.wantgoo.com/stock/2201/major-investors/branch-buysell
請問我嘗試爬上面的分點網址,自動登入後,但是碰到的奇怪的問題,
就是用一般chrome可以看到分點資料,
但是用selenium分點欄位資料變為空白,設定了很多option也是無法....

看起來這網站不知道用了甚麼手法。擋住selenium 的爬蟲,希望能有大神能幫幫忙....

撈交易所不就好了嗎
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

3
echochio
iT邦高手 1 級 ‧ 2021-08-25 17:03:31

基本上路封包 加 user agent header
python requests 都可做到
是有遇過 擋住selenium 的爬蟲 的(擋 user agent)
selenium 使用偽造的 user-agent 試試

from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference("general.useragent.override", "whatever you want")
driver = webdriver.Firefox(profile)
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
opts = Options()
opts.add_argument("user-agent=whatever you want")

driver = webdriver.Chrome(chrome_options=opts)

我要發表回答

立即登入回答