I try
necessaryStuffOnly = SoupStrainer("table",{"class": "views-table"})
soup = BeautifulSoup(vegetables,parse_only=necessaryStuffOnly)
without luck on a table like this:
<div class="view-content">
<table class="views-table sticky-enabled cols-20">
<thead>
<tr>
<td>blablaba</td>
</tr>
</thead>
<tbody>
<tr>
<td>more blablabla</td>
</tr>
</tbody>
</table>
</div>
and this does work for the div
SoupStrainer("div",{"class": "view-content"})
Can’t a SoupStrainer like this filter on element with multiple classes?
The comparision that’s used is a literal equality check, so the following works:
You can get it to match by doing by passing a function as to the filter:
It might be worth checking the version you’re using, because I have a feeling this shouldn’t be the case anymore… update: yup, here you go https://bugs.launchpad.net/beautifulsoup/+bug/410304