<s> from __future__ import unicode_literals <EOL> import re <EOL> from . common import InfoExtractor <EOL> from . . utils import unified_strdate <EOL> class DreiSatIE ( InfoExtractor ) : <EOL> IE_NAME = '<STR_LIT>' <EOL> _VALID_URL = r'<STR_LIT>' <EOL> _TEST = { <EOL> '<STR_LIT:url>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:id>' : '<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> '<STR_LIT>' : '<STR_LIT>' <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> details_url = '<STR_LIT>' % video_id <EOL> details_doc = self . _download_xml ( details_url , video_id , '<STR_LIT>' ) <EOL> thumbnail_els = details_doc . findall ( '<STR_LIT>' ) <EOL> thumbnails = [ { <EOL> '<STR_LIT:width>' : int ( te . attrib [ '<STR_LIT:key>' ] . partition ( '<STR_LIT:x>' ) [ <NUM_LIT:0> ] ) , <EOL> '<STR_LIT>' : int ( te . attrib [ '<STR_LIT:key>' ] . partition ( '<STR_LIT:x>' ) [ <NUM_LIT:2> ] ) , <EOL> '<STR_LIT:url>' : te . text , <EOL> } for te in thumbnail_els ] <EOL> information_el = details_doc . find ( '<STR_LIT>' ) <EOL> video_title = information_el . find ( '<STR_LIT>' ) . text <EOL> video_description = information_el . find ( '<STR_LIT>' ) . text <EOL> details_el = details_doc . find ( '<STR_LIT>' ) <EOL> video_uploader = details_el . find ( '<STR_LIT>' ) . text <EOL> upload_date = unified_strdate ( details_el . find ( '<STR_LIT>' ) . text ) <EOL> format_els = details_doc . findall ( '<STR_LIT>' ) <EOL> formats = [ { <EOL> '<STR_LIT>' : fe . attrib [ '<STR_LIT>' ] , <EOL> '<STR_LIT:width>' : int ( fe . find ( '<STR_LIT>' ) . text ) , <EOL> '<STR_LIT>' : int ( fe . find ( '<STR_LIT>' ) . text ) , <EOL> '<STR_LIT:url>' : fe . find ( '<STR_LIT>' ) . text , <EOL> '<STR_LIT>' : int ( fe . find ( '<STR_LIT>' ) . text ) , <EOL> '<STR_LIT>' : int ( fe . find ( '<STR_LIT>' ) . text ) , <EOL> } for fe in format_els <EOL> if not fe . find ( '<STR_LIT>' ) . text . startswith ( '<STR_LIT>' ) ] <EOL> self . _sort_formats ( formats ) <EOL> return { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:id>' : video_id , <EOL> '<STR_LIT:title>' : video_title , <EOL> '<STR_LIT>' : formats , <EOL> '<STR_LIT:description>' : video_description , <EOL> '<STR_LIT>' : thumbnails , <EOL> '<STR_LIT>' : thumbnails [ - <NUM_LIT:1> ] [ '<STR_LIT:url>' ] , <EOL> '<STR_LIT>' : video_uploader , <EOL> '<STR_LIT>' : upload_date , <EOL> } </s>
