【发布时间】:2019-06-25 17:33:33
【问题描述】:
我想用 requests 和 beautifulsoup 运行一个简单的抓取机器人,但我无法确定我需要获取的元素,这就是令牌的欧盟价格
import requests
from bs4 import BeautifulSoup
link = "https://wowtokenprices.com/"
res = requests.get(link , headers={'User-Agent':'Mozilla/5.0'})
soup = BeautifulSoup(res.text,'html.parser')
container = soup.find_all("div", {"class":"col-sm-6 col-md-4 col-12 region-div eu-region-div"})
print (container)
打印输出包含我需要抓取的元素的数据较少
【问题讨论】:
-
我不建议使用这样的类来抓取数据。有一天我可能会决定改变课程。 ;) 此外,还有一个您可以使用的 json 提要。 wowtokenprices.com/current_prices.json
标签: html python-3.x web-scraping beautifulsoup