<s> from __future__ import unicode_literals <EOL> import re <EOL> from . common import InfoExtractor <EOL> from . . compat import ( <EOL> compat_urlparse , <EOL> ) <EOL> from . . utils import ( <EOL> ExtractorError , <EOL> ) <EOL> class NovaMovIE ( InfoExtractor ) : <EOL> IE_NAME = '<STR_LIT>' <EOL> IE_DESC = '<STR_LIT>' <EOL> _VALID_URL_TEMPLATE = r'<STR_LIT>' <EOL> _VALID_URL = _VALID_URL_TEMPLATE % { '<STR_LIT:host>' : '<STR_LIT>' } <EOL> _HOST = '<STR_LIT>' <EOL> _FILE_DELETED_REGEX = r'<STR_LIT>' <EOL> _FILEKEY_REGEX = r'<STR_LIT>' <EOL> _TITLE_REGEX = r'<STR_LIT>' <EOL> _DESCRIPTION_REGEX = 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> } , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> def _real_extract ( self , url ) : <EOL> mobj = re . match ( self . _VALID_URL , url ) <EOL> video_id = mobj . group ( '<STR_LIT:id>' ) <EOL> page = self . _download_webpage ( <EOL> '<STR_LIT>' % ( self . _HOST , video_id ) , video_id , '<STR_LIT>' ) <EOL> if re . search ( self . _FILE_DELETED_REGEX , page ) is not None : <EOL> raise ExtractorError ( '<STR_LIT>' % video_id , expected = True ) <EOL> filekey = self . _search_regex ( self . _FILEKEY_REGEX , page , '<STR_LIT>' ) <EOL> title = self . _html_search_regex ( self . _TITLE_REGEX , page , '<STR_LIT:title>' , fatal = False ) <EOL> description = self . _html_search_regex ( self . _DESCRIPTION_REGEX , page , '<STR_LIT:description>' , default = '<STR_LIT>' , fatal = False ) <EOL> api_response = self . _download_webpage ( <EOL> '<STR_LIT>' % ( self . _HOST , filekey , video_id ) , video_id , <EOL> '<STR_LIT>' ) <EOL> response = compat_urlparse . parse_qs ( api_response ) <EOL> if '<STR_LIT>' in response : <EOL> raise ExtractorError ( '<STR_LIT>' % ( self . IE_NAME , response [ '<STR_LIT>' ] [ <NUM_LIT:0> ] ) , expected = True ) <EOL> video_url = response [ '<STR_LIT:url>' ] [ <NUM_LIT:0> ] <EOL> return { <EOL> '<STR_LIT:id>' : video_id , <EOL> '<STR_LIT:url>' : video_url , <EOL> '<STR_LIT:title>' : title , <EOL> '<STR_LIT:description>' : description <EOL> } </s>
