BeautifulSoup getting href of a list with ++ records
I have the following soup:
<a href="some_url">next</a>
<span class="class">...</span>
From this I want to extract the href, "some_url"
and the whole list of the pages that are listed on this page: https://www.catholic-hierarchy.org/diocese/laa.html
note: there are a whole lot of links to sub-pages: which i need to parse. at the moment: I'm using the standard documentation over at Crummy, but I'm looking for something a little more organized.
what i have is:
from BeautifulSoup import BeautifulSoup
html = '''<a href="https://www.catholic-hierarchy.org/diocese/laa.html">next</a>
<span class="class"><a href="another_url">later</a></span>'''
soup = BeautifulSoup(html)
for a in soup.find_all('a', href=True):
print ("Found the URL:", a['href'])
The expected output should be:
Found the URL: some_url
Found the URL: another_url
and if you look at the page mentioned above i want all tags with an href, so i thought that i have to omit the name parameter:
href_tags = soup.find_all(href=True)
any ideas how to get the first steps done..!?
