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

11 lines
353 B
Python
Raw Normal View History

2021-08-31 21:57:54 +00:00
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