如该评论所述,您可使用<代码>re模块查询:
import re
import requests
from bs4 import BeautifulSoup
url = "https://www.boekenprijs.be/uitgebreid-zoeken?zoek=&veld=all&gbpstartdatumvan=&gbpstartdatumtotenmet=&gbpeinddatumvan=01/04/2024&gbpeinddatumtotenmet=12/08/2024&_token=FAoSCCoUK-SPrL-ktj4MtsVBv3L4K-FaH3jxSo259D0&page=1"
result = requests.get(url)
doc = BeautifulSoup(result.text, "html.parser")
aux = doc.find_all(string=re.compile("ISBN"))
print(aux)
印刷:
[
ISBN ,
ISBN ,
ISBN ,
ISBN ,
ISBN ,
ISBN ,
ISBN ,
ISBN ,
ISBN ,
ISBN ]
但是,更有用的是寻找载有“ISBN”的超文本标签:
for tag in doc.select( :-soup-contains-own("ISBN") ):
print(tag.prettify())
印刷:
...
<div class="col-12 col-md-4 text-right">
<strong>
<span class="price">
€ 24.95
</span>
</strong>
<br/>
Van
<strong>
01-10-2023
</strong>
t.e.m.
<strong>
01-04-2024
</strong>
<br/>
ISBN
<strong>
9789090374475
</strong>
<br/>
</div>
...