improve semantics for media:end
fix string index bug in extract_html_attributes