79624265

Date: 2025-05-15 22:52:31
Score: 3.5
Natty:
Report link

Final function is below. If you have better way to code that, please share :-). Thanks!

def get_booksurl_in_theme_page(htmlfile: Path):

    bookslinks = []

    if htmlfile.is_file() and htmlfile.suffix == '.html':

        bs4_soup = BeautifulSoup(htmlfile.read_text(), 'html.parser')
        bs4_bookslinks = bs4_soup.select('h4.title > a')

        for tag_a in bs4_bookslinks:
            bookslinks.append(tag_a.get('href'))

    else:
        logging.debug("get_booksurl_in_theme_page appele: param n'est pas un fichier")

    return bookslinks
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • RegEx Blacklisted phrase (2.5): please share
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Caroline