iT邦幫忙

0

(以解決) python selenium 如何獲取回傳的json檔

  • 分享至 

  • xImage

我目前使用python selenium,瀏覽器是firefox,
想要爬網站中的提供的分析內容,

發現在get前往網址後會得到Type是json的lists,像是下圖
20135688kbpNgPixv0.png

類似問題像是下面這個網站
連結

那我希望能得到lists中的內容或是lists這份檔案,
試了print(driver.page_source)的內容來看也沒發現想要的內容
想問看看能怎麼下手 拜託了


目前用把selenium 換成 seleniumwire
用以下方式把response全部抓出來看,
終於成功抓到想要的json檔

for request in driver.requests:
    if request.response:
        print(
            request.url,
            request.response.status_code,
            request.response.headers['Content-Type']
        )
obarisk iT邦研究生 2 級 ‧ 2022-05-23 12:29:25 檢舉
如果可以看到http請求,那開 selenium 有點多餘
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答