你好!我正试图从这个网站https://www.flashscore.com/player/nadal-rafael/xUwlUnRK/results/获取有关匹配的信息 代码为:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from bs4 import BeautifulSoup
options = Options()
options.add_argument("--headless")
profile = webdriver.FirefoxProfile()
profile.set_preference('permissions.default.image', 2)
driver = webdriver.Firefox(firefox_options = options, firefox_profile=profile)
driver.implicitly_wait(40)
driver.get('https://www.flashscore.com/player/nadal-rafael/xUwlUnRK/results/')
src = driver.page_source
soup = BeautifulSoup(src, "html.parser")
table = soup.prettify()
f = open('text.txt', 'w', encoding='utf-8')
f.write(table)
f.close()
driver.close()
但最后,所有文本都在带有^{id1}的标记内包含匹配项$
<div class="fs-passive fs-table tournament-page" id="fs-results_s">
</div>
。我试过使用Chrome,但没用。 可能是什么错误
目前没有回答
相关问题 更多 >
编程相关推荐