<s> from __future__ import unicode_literals <EOL> import re <EOL> from . common import InfoExtractor <EOL> class MDRIE ( InfoExtractor ) : <EOL> _VALID_URL = r'<STR_LIT>' <EOL> _TEST = { <EOL> '<STR_LIT:url>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True , <EOL> } <EOL> def _real_extract ( self , url ) : <EOL> m = re . match ( self . _VALID_URL , url ) <EOL> video_id = m . group ( '<STR_LIT>' ) <EOL> domain = m . group ( '<STR_LIT>' ) <EOL> html = self . _download_webpage ( url , video_id ) <EOL> title = self . _html_search_regex ( r'<STR_LIT>' , html , '<STR_LIT:title>' ) <EOL> xmlurl = self . _search_regex ( <EOL> r'<STR_LIT>' , html , '<STR_LIT>' ) <EOL> doc = self . _download_xml ( domain + xmlurl , video_id ) <EOL> formats = [ ] <EOL> for a in doc . findall ( '<STR_LIT>' ) : <EOL> url_el = a . find ( '<STR_LIT>' ) <EOL> if url_el is None : <EOL> continue <EOL> abr = int ( a . find ( '<STR_LIT>' ) . text ) // <NUM_LIT:1000> <EOL> media_type = a . find ( '<STR_LIT>' ) . text <EOL> format = { <EOL> '<STR_LIT>' : abr , <EOL> '<STR_LIT>' : int ( a . find ( '<STR_LIT>' ) . text ) , <EOL> '<STR_LIT:url>' : url_el . text , <EOL> } <EOL> vbr_el = a . find ( '<STR_LIT>' ) <EOL> if vbr_el is None : <EOL> format . update ( { <EOL> '<STR_LIT>' : '<STR_LIT:none>' , <EOL> '<STR_LIT>' : '<STR_LIT>' % ( media_type , abr ) , <EOL> } ) <EOL> else : <EOL> vbr = int ( vbr_el . text ) // <NUM_LIT:1000> <EOL> format . update ( { <EOL> '<STR_LIT>' : vbr , <EOL> '<STR_LIT:width>' : int ( a . find ( '<STR_LIT>' ) . text ) , <EOL> '<STR_LIT>' : int ( a . find ( '<STR_LIT>' ) . text ) , <EOL> '<STR_LIT>' : '<STR_LIT>' % ( media_type , vbr ) , <EOL> } ) <EOL> formats . append ( format ) <EOL> self . _sort_formats ( formats ) <EOL> return { <EOL> '<STR_LIT:id>' : video_id , <EOL> '<STR_LIT:title>' : title , <EOL> '<STR_LIT>' : formats , <EOL> } </s>
