May-16-2021, 08:41 AM
Hello dear pythonistas - hello dear python-experts,
hope everything is all right and youre well. i am doing some tests with SoupStrainer
all with a bold tag:
hope everything is all right and youre well. i am doing some tests with SoupStrainer
import requests from bs4 import BeautifulSoup, SoupStrainer content = requests.get('https://www.google.com').content for link in BeautifulSoup(content, parse_only=SoupStrainer('a')): if hasattr(link, "href"): print(link['href'])note: i only want to have the links that are in bold tags
all with a bold tag:
<li><b><a href="linkitem_a.html">linkitem_a</a></b> {bla_bla_a} (bla_bla_a), apple_crumble </li> <li><a href="linkitem_b.html">linkitem_b</a> {bla_bla_b} (bla_bla_b), apple_crumble </li> <li><b><a href="linkitem_c.html">linkitem_c</a></b> {bla_bla_c} (bla_bla_c), apple_crumblehow to implement this condition in the souStrainer-code-parser!?
Wordpress - super toolkits a. http://wpgear.org/ :: und b. https://github.com/miziomon/awesome-wordpress :: Awesome WordPress: A curated list of amazingly awesome WordPress resources and awesome python things https://github.com/vinta/awesome-python