mirror of
https://codeberg.org/polarisfm/youtube-dl.git
synced 2024-12-25 01:01:39 +00:00
[utils] PEP 8
This commit is contained in:
parent
96f4f796fb
commit
c5229f3926
2 changed files with 7 additions and 4 deletions
|
@ -273,15 +273,17 @@ def get_element_by_attribute(attribute, value, html):
|
||||||
|
|
||||||
return unescapeHTML(res)
|
return unescapeHTML(res)
|
||||||
|
|
||||||
|
|
||||||
class HTMLAttributeParser(compat_HTMLParser):
|
class HTMLAttributeParser(compat_HTMLParser):
|
||||||
"""Trivial HTML parser to gather the attributes for a single element"""
|
"""Trivial HTML parser to gather the attributes for a single element"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.attrs = { }
|
self.attrs = {}
|
||||||
compat_HTMLParser.__init__(self)
|
compat_HTMLParser.__init__(self)
|
||||||
|
|
||||||
def handle_starttag(self, tag, attrs):
|
def handle_starttag(self, tag, attrs):
|
||||||
self.attrs = dict(attrs)
|
self.attrs = dict(attrs)
|
||||||
|
|
||||||
|
|
||||||
def extract_attributes(html_element):
|
def extract_attributes(html_element):
|
||||||
"""Given a string for an HTML element such as
|
"""Given a string for an HTML element such as
|
||||||
<el
|
<el
|
||||||
|
@ -303,6 +305,7 @@ def extract_attributes(html_element):
|
||||||
parser.close()
|
parser.close()
|
||||||
return parser.attrs
|
return parser.attrs
|
||||||
|
|
||||||
|
|
||||||
def clean_html(html):
|
def clean_html(html):
|
||||||
"""Clean an HTML snippet into a readable string"""
|
"""Clean an HTML snippet into a readable string"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue