擅长:python、mysql、java
<p>您需要使用<a href="http://selenium-python.readthedocs.io/" rel="nofollow noreferrer">selenium</a>,因为我试图用<code>requests</code>来完成,但它不起作用,因为数据是用<code>javascript</code>加载的,后面跟着<code>bs4</code></p>
<pre><code>import requests, bs4
from selenium import webdriver
driver = webdriver.Chrome('/usr/local/bin/chromedriver')
website = "https://www.the-blockchain.com/2018/06/29/mcafee-labs-report-6x-increase-in-crypto-mining-malware-incidents-in-q1-2018/"
driver.get(website)
html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")
elements = soup.select('#wpautbox_latest-post > ul > li')
for elem in elements:
print(elem.text)
</code></pre>
<p><strong>输出</strong></p>
^{pr2}$