i want to obtain specific hrefs from this this. here is what i have so far:
req = requests.get(mainUrl)
soup = BeautifulSoup(req.text, 'html.parser')
keywords = 'Supreme®/Schott® Fringe Suede Coat'
colors = "Black"
for a in soup.find_all('a', {'class': 'name-link'}, text=True):
if keywords and colors in a:
print(a['href'])
当一个div内部文章下有“关键字”和“颜色”时,我如何才能进一步缩小此范围以获取href?
使用库SimplifiedDoc的解决方案。
结果: