Merge branch 'brightcove_in_page_embed' of https://github.com/remitamine/youtube-dl into remitamine-brightcove_in_page_embed

This commit is contained in:
Sergey M․ 2015-11-14 01:23:15 +06:00
commit a2973eb597
4 changed files with 128 additions and 2 deletions

View file

@ -259,6 +259,15 @@ def get_element_by_attribute(attribute, value, html):
return unescapeHTML(res)
def extract_attributes(attributes_str, attributes_regex=r'(?s)\s*([^\s=]+)\s*=\s*["\']([^"\']+)["\']'):
attributes = re.findall(attributes_regex, attributes_str)
attributes_dict = {}
if attributes:
for (attribute_name, attribute_value) in attributes:
attributes_dict[attribute_name] = attribute_value
return attributes_dict
def clean_html(html):
"""Clean an HTML snippet into a readable string"""