]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/meta.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from .pladform 
import PladformIE
 
  13 class METAIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://video\.meta\.ua/(?:iframe/)?(?P<id>[0-9]+)' 
  16         'url': 'http://video.meta.ua/5502115.video', 
  17         'md5': '71b6f3ee274bef16f1ab410f7f56b476', 
  21             'title': 'Sony Xperia Z camera test [HQ]', 
  22             'description': 'Xperia Z shoots video in FullHD HDR.', 
  23             'uploader_id': 'nomobile', 
  24             'uploader': 'CHЁZA.TV', 
  25             'upload_date': '20130211', 
  27         'add_ie': ['Youtube'], 
  29         'url': 'http://video.meta.ua/iframe/5502115', 
  30         'only_matching': True, 
  33         'url': 'http://video.meta.ua/7121015.video', 
  34         'only_matching': True, 
  37     def _real_extract(self
, url
): 
  38         video_id 
= self
._match
_id
(url
) 
  39         webpage 
= self
._download
_webpage
(url
, video_id
) 
  41         st_html5 
= self
._search
_regex
( 
  42             r
"st_html5\s*=\s*'#([^']+)'", webpage
, 'uppod html5 st', default
=None) 
  45             # uppod st decryption algorithm is reverse engineered from function un(s) at uppod.js 
  47             for i 
in range(0, len(st_html5
), 3): 
  48                 json_str 
+= '�%s;' % st_html5
[i
:i 
+ 3] 
  49             uppod_data 
= self
._parse
_json
(unescapeHTML(json_str
), video_id
) 
  50             error 
= uppod_data
.get('customnotfound') 
  52                 raise ExtractorError('%s said: %s' % (self
.IE_NAME
, error
), expected
=True) 
  54             video_url 
= uppod_data
['file'] 
  58                 'title': uppod_data
.get('comment') or self
._og
_search
_title
(webpage
), 
  59                 'description': self
._og
_search
_description
(webpage
, default
=None), 
  60                 'thumbnail': uppod_data
.get('poster') or self
._og
_search
_thumbnail
(webpage
), 
  61                 'duration': int_or_none(self
._og
_search
_property
( 
  62                     'video:duration', webpage
, default
=None)), 
  64             if 'youtube.com/' in video_url
: 
  66                     '_type': 'url_transparent', 
  71         pladform_url 
= PladformIE
._extract
_url
(webpage
) 
  73             return self
.url_result(pladform_url
)