BeautifulSoup, findAll after findAll?
<p>I'm pretty new to Python and mainly need it for getting information from websites.
Here I tried to get the short headlines from the bottom of the website, but cant quite get them.</p>

<pre><code>from bfs4 import BeautifulSoup
import requests

url = "http://some-website"
r = requests.get(url)
soup = BeautifulSoup(r.content, "html.parser")

nachrichten = soup.findAll('ul', {'class':'list'})
</code></pre>

<p>Now I would need another findAll to get all the links/a from the var "nachrichten", but how can I do this ?</p>

<p>Use a <em>css selector</em> with select if you want all the links in a single list:</p>

<pre><code>anchors = soup.select('ul.list a')
</code></pre>

<p>If you want individual lists:</p>

<pre><code>anchors = [ ul.find_all(a) for a in soup.find_all('ul', {'class':'list'})]
</code></pre>

<p>Also if you want the hrefs you can make sure you only find the anchors with <em>href</em> attributes and extract:</p>

<pre><code>hrefs = [a["href"] for a in soup.select('ul.list a[href]')]
</code></pre>

<p>With  <code>find_all</code> set <em>href=True</em> i.e <code>ul.find_all(a, href=True)</code> .</p>

python beautifulsoup python-requests