This repository has been archived on 2024-07-02. You can view files and clone it, but cannot push or open issues or pull requests.
Netflix-videos-downloader/utils/modules/pycaption/utils.py
2021-09-01 02:57:54 +05:00

11 lines
353 B
Python

def is_leaf(element):
"""
Return True if the element is a leaf, False otherwise. The element is
considered a leaf if it is either NavigableString or the "br" tag
:param element: A BeautifulSoup tag or NavigableString
"""
name = getattr(element, 'name', None)
if not name or name == 'br':
return True
return False