title: Finding all classes in HTML with BeautifulSoup
body: <p>BeautifulSoup is easy to use if you know the class(es) you want to target. I, however, am scraping a site that changes the classes used in its HTML periodically. (Presumably, to keep people like me from doing what I'm trying to do.)</p>
  <p>To counter-attack this defensive maneuver, I want to use BeautifulSoup to look at the structure of the page and suss out which classes I am interested in. In effect, &quot;find a <code>div</code> with class &quot;A&quot; that has twenty <code>div</code>'s with class &quot;B&quot; as immediate children,&quot; to determine the strings &quot;A&quot; and &quot;B&quot;.</p>
  <p>I'm reasonably certain BS can be used to accomplish this. I'm also reasonably certain that it would be faster to get help from the community than try to figure this out on my own. I could recursively build a tree of <code>div</code>'s, which may be the best solution, but I'm not sure how to account for the fact that some <code>div</code>'s belong to multiple CSS classes.</p>