HTML Scraping with BeautifulSoup
<p>I'm trying to search </p>

<pre><code>&lt;span&gt;Status:&lt;/span&gt;,
  &lt;span&gt;&lt;strong&gt;Moored&lt;/strong&gt;&lt;/span&gt;,
  &lt;strong&gt;Moored&lt;/strong
</code></pre>

<p>And pull out <code>Moored</code>. I've tried a lot of things but haven't been able to get it. Most recently <code>find(attrs={'span':'Status:'})</code> but that just returns <code>[]</code>. There are a lot of things tagged with <code>&lt;strong&gt;</code> in the HTML, but this is the only <code>&lt;strong&gt;</code> after a <code>&lt;span&gt;Status:</code></p>

<p>Edit: the HTML snipped above is a result of running
<code>a = soup.find_all(attrs={'class':'vertical-offset-10 group-ib'})</code> then iterating over each loop with <code>a = (row.findChildren())</code></p>

<p>In the HTML: </p>

<pre><code>&lt;div class="vertical-offset-10 group-ib"&gt;
                    &lt;span&gt;Status:&lt;/span&gt;
                    &lt;span&gt;&lt;strong&gt;Moored&lt;/strong&gt;&lt;/span&gt;
                &lt;/div&gt;
</code></pre>

<p>To clarify, all I want is the string <code>Moored</code></p>

<pre><code>res = soup.find_all('span', text="Status:")
res[0].parent.find('strong').text
</code></pre>

<p>soup.find_all searches for all <code>&lt;span&gt;</code> tags that contain the text <code>"Result:"</code>, then takes the next_sibling (the next <code>&lt;span&gt;</code> tag) and gets that tag's text contents. </p>

python html beautifulsoup