Skip to content

Commit

Permalink
don't crash if embedded anchors are missing href (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
facundoolano committed Mar 4, 2024
1 parent 69802a9 commit 8547bcb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion feedi/scraping.py
Expand Up @@ -89,7 +89,7 @@ def all_meta(soup):
def extract_links(url, html):
soup = BeautifulSoup(html, 'lxml')
# checks tag.text so it skips image links
links = soup.find_all(lambda tag: tag.name == 'a' and tag.text)
links = soup.find_all(lambda tag: tag.name == 'a' and tag.text and 'href' in tag)
return [(make_absolute(url, a['href']), a.text) for a in links]


Expand Down

0 comments on commit 8547bcb

Please sign in to comment.