This commit is contained in:
widevinedump
2021-12-28 03:24:34 +05:30
parent 4fa654e177
commit c4e6ea37a8
131 changed files with 1006105 additions and 2 deletions

View File

@@ -0,0 +1,10 @@
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