有这样一个 网站,我想用这个链接解析这个播放器的数据
我为此编写了这段代码:
import requests
from bs4 import BeautifulSoup
def get_html():
r = requests.get(url='https://www.atptour.com/en/players/felix-auger-aliassime/ag37/overview')
return r.text
html = get_html()
def get_career(html):
soup = BeautifulSoup(html, 'lxml')
career = soup.find('tr')
print(career)
get_career(html)
但事情是这样的,我正在解析的链接是一个单页应用程序,因此,我需要的数据
没有出现在页面的完整 html 代码中。
使用 SPA 抓取网站的最佳方法是什么?
使用 Selenium 库和 Chrome 浏览器的解析选项。