擅长:python、mysql、java
<p>此脚本将打印Top Operators部分的所有<code><img></code>标题:</p>
<pre><code>from bs4 import BeautifulSoup as bs
import requests
bsURL = "https://r6.tracker.network/profile/pc/Spoit.GODSENT"
respinse = requests.get(bsURL)
html = bs(respinse.text, 'html.parser')
# find Top Operators tag
operators = html.find(class_='trn-defstat__name', text='Top Operators')
for img in operators.find_next('div').find_all('img'):
print(img['title'])
</code></pre>
<p>印刷品:</p>
<pre><code>ASH
JÄGER
BANDIT
</code></pre>
<hr/>
<p>或使用CSS:</p>
<pre><code>for img in html.select('.trn-defstat__name:contains("Top Operators") + * img'):
print(img['title'])
</code></pre>