BeautifulSoup: Find any tag that matches one tag by name, or another tag by attribute
How about concatenate two results like bs.find_all('h1') + bs.find_all(['div', attrs={'class': 'abc'}) ?
I want to find all tags that are either <h1> OR <div class='abc'>. I tried bs.find_all(['h1', 'div'], attrs={'class': 'abc'}), but this will ignore the <h1> tags: apparently, the attrs argument applies an AND condition to the search (meaning the tag must belong to the list of tag name AND have the given attribute, which the <h1> tags do not meet).
Can anyone suggest a fix to this? Thank you.