Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0939f1e5 authored by Arnau Vàzquez's avatar Arnau Vàzquez
Browse files

Merge branch 'fallback-any-h1' into 'master'

Fallback to any h1 for title when parsing

See merge request !4
parents 378a25a0 2a7d56df
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ def get_title_from_htmltree(htmltree: BeautifulSoup):
    title = htmltree.select_one('[data-elasticsearch-title]')
    if title == None:
        title = htmltree.find('h1', { "class" : "post-title" })
    if title == None:
        title = htmltree.find('h1')
    if title == None:
        return None
    return title.text.strip()