[闲聊] 请教如何抓class下面的资讯

楼主: garlic774 (蒜头)   2021-11-18 23:12:27
各位大大晚安,想请教如何可以正确爬得正确资讯
[in]
import urllib.parse
import requests
import time
import json
import os
from bs4 import BeautifulSoup
url =
'https://tw.mall.yahoo.com/store/%E5%B1%88%E8%87%A3%E6%B0%8FWatsons:watsons'
USER_AGENT_VALUE = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36'
headers = {'User-Agent': USER_AGENT_VALUE}
res = requests.get(url, headers=headers)
soup = BeautifulSoup(res.text, 'html.parser')
b = soup.find_all(class_='sc-hzMMVR gYfXYo')
print(b)
[out]
[]
请问为何会抓不到class下面的内容呢? 但是改用selenium.webdriver又可以了?
作者: Woqeker (窝颗ker)   2021-11-19 02:00:00
前端渲染
作者: ToastBen (吐司边)   2021-11-19 03:13:00

Links booklink

Contact Us: admin [ a t ] ucptt.com