<s> from __future__ import unicode_literals <EOL> import re <EOL> from . common import InfoExtractor <EOL> from . . compat import ( <EOL> compat_str , <EOL> ) <EOL> from . . utils import ( <EOL> ExtractorError , <EOL> clean_html , <EOL> ) <EOL> class MovieClipsIE ( InfoExtractor ) : <EOL> _VALID_URL = r'<STR_LIT>' <EOL> _TEST = { <EOL> '<STR_LIT:url>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:title>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : True , <EOL> } <EOL> } <EOL> def _real_extract ( self , url ) : <EOL> mobj = re . match ( self . _VALID_URL , url ) <EOL> video_id = mobj . group ( '<STR_LIT:id>' ) <EOL> display_id = mobj . group ( '<STR_LIT>' ) <EOL> show_id = display_id or video_id <EOL> config = self . _download_xml ( <EOL> '<STR_LIT>' % video_id , <EOL> show_id , '<STR_LIT>' ) <EOL> if config . find ( '<STR_LIT>' ) . text == '<STR_LIT:false>' : <EOL> raise ExtractorError ( <EOL> '<STR_LIT>' % ( self . IE_NAME , config . find ( '<STR_LIT>' ) . text ) , expected = True ) <EOL> properties = config . find ( '<STR_LIT>' ) <EOL> smil_file = properties . attrib [ '<STR_LIT>' ] <EOL> smil = self . _download_xml ( smil_file , show_id , '<STR_LIT>' ) <EOL> base_url = smil . find ( '<STR_LIT>' ) . attrib [ '<STR_LIT>' ] <EOL> formats = [ ] <EOL> for video in smil . findall ( '<STR_LIT>' ) : <EOL> vbr = int ( video . attrib [ '<STR_LIT>' ] ) / <NUM_LIT:1000> <EOL> src = video . attrib [ '<STR_LIT:src>' ] <EOL> formats . append ( { <EOL> '<STR_LIT:url>' : base_url , <EOL> '<STR_LIT>' : src , <EOL> '<STR_LIT>' : src . split ( '<STR_LIT::>' ) [ <NUM_LIT:0> ] , <EOL> '<STR_LIT>' : vbr , <EOL> '<STR_LIT>' : '<STR_LIT>' % vbr , <EOL> } ) <EOL> self . _sort_formats ( formats ) <EOL> title = '<STR_LIT>' % ( properties . attrib [ '<STR_LIT>' ] , properties . attrib [ '<STR_LIT>' ] ) <EOL> description = clean_html ( compat_str ( properties . attrib [ '<STR_LIT>' ] ) ) <EOL> thumbnail = properties . attrib [ '<STR_LIT:image>' ] <EOL> categories = properties . attrib [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002C>' ) <EOL> return { <EOL> '<STR_LIT:id>' : video_id , <EOL> '<STR_LIT>' : display_id , <EOL> '<STR_LIT:title>' : title , <EOL> '<STR_LIT:description>' : description , <EOL> '<STR_LIT>' : thumbnail , <EOL> '<STR_LIT>' : categories , <EOL> '<STR_LIT>' : formats , <EOL> } </s>
