<s> from __future__ import unicode_literals <EOL> import json <EOL> from . common import InfoExtractor <EOL> from . . utils import ( <EOL> ExtractorError , <EOL> ) <EOL> class CNETIE ( 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:title>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> } <EOL> def _real_extract ( self , url ) : <EOL> display_id = self . _match_id ( url ) <EOL> webpage = self . _download_webpage ( url , display_id ) <EOL> data_json = self . _html_search_regex ( <EOL> r"<STR_LIT>" , <EOL> webpage , '<STR_LIT>' ) <EOL> data = json . loads ( data_json ) <EOL> vdata = data [ '<STR_LIT>' ] <EOL> if not vdata : <EOL> vdata = data [ '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> if not vdata : <EOL> raise ExtractorError ( '<STR_LIT>' ) <EOL> mpx_account = data [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT:default>' ] [ '<STR_LIT>' ] <EOL> vid = vdata [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> tp_link = '<STR_LIT>' % ( mpx_account , vid ) <EOL> video_id = vdata [ '<STR_LIT:id>' ] <EOL> title = vdata . get ( '<STR_LIT>' ) <EOL> if title is None : <EOL> title = vdata . get ( '<STR_LIT:title>' ) <EOL> if title is None : <EOL> raise ExtractorError ( '<STR_LIT>' ) <EOL> thumbnail = vdata . get ( '<STR_LIT:image>' , { } ) . get ( '<STR_LIT:path>' ) <EOL> author = vdata . get ( '<STR_LIT>' ) <EOL> if author : <EOL> uploader = '<STR_LIT>' % ( author [ '<STR_LIT>' ] , author [ '<STR_LIT>' ] ) <EOL> uploader_id = author . get ( '<STR_LIT:id>' ) <EOL> else : <EOL> uploader = None <EOL> uploader_id = None <EOL> return { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:url>' : tp_link , <EOL> '<STR_LIT:id>' : video_id , <EOL> '<STR_LIT>' : display_id , <EOL> '<STR_LIT:title>' : title , <EOL> '<STR_LIT>' : uploader , <EOL> '<STR_LIT>' : uploader_id , <EOL> '<STR_LIT>' : thumbnail , <EOL> } </s>
