]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/fivetv.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..utils 
import int_or_none
 
  10 class FiveTVIE(InfoExtractor
): 
  15                             (?:[^/]+/)+(?P<id>\d+)| 
  16                             (?P<path>[^/?#]+)(?:[/?#])? 
  21         'url': 'http://5-tv.ru/news/96814/', 
  22         'md5': 'bbff554ad415ecf5416a2f48c22d9283', 
  26             'title': 'Россияне выбрали имя для общенациональной платежной системы', 
  27             'description': 'md5:a8aa13e2b7ad36789e9f77a74b6de660', 
  28             'thumbnail': r
're:^https?://.*\.jpg$', 
  32         'url': 'http://5-tv.ru/video/1021729/', 
  36             'title': '3D принтер', 
  37             'description': 'md5:d76c736d29ef7ec5c0cf7d7c65ffcb41', 
  38             'thumbnail': r
're:^https?://.*\.jpg$', 
  42         # redirect to https://www.5-tv.ru/projects/1000095/izvestia-glavnoe/ 
  43         'url': 'http://www.5-tv.ru/glavnoe/#itemDetails', 
  47             'title': r
're:^Итоги недели с \d+ по \d+ \w+ \d{4} года$', 
  48             'thumbnail': r
're:^https?://.*\.jpg$', 
  50         'skip': 'redirect to «Известия. Главное» project page', 
  52         'url': 'http://www.5-tv.ru/glavnoe/broadcasts/508645/', 
  53         'only_matching': True, 
  55         'url': 'http://5-tv.ru/films/1507502/', 
  56         'only_matching': True, 
  58         'url': 'http://5-tv.ru/programs/broadcast/508713/', 
  59         'only_matching': True, 
  61         'url': 'http://5-tv.ru/angel/', 
  62         'only_matching': True, 
  64         'url': 'http://www.5-tv.ru/schedule/?iframe=true&width=900&height=450', 
  65         'only_matching': True, 
  68     def _real_extract(self
, url
): 
  69         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  70         video_id 
= mobj
.group('id') or mobj
.group('path') 
  72         webpage 
= self
._download
_webpage
(url
, video_id
) 
  74         video_url 
= self
._search
_regex
( 
  75             [r
'<div[^>]+?class="(?:flow)?player[^>]+?data-href="([^"]+)"', 
  76              r
'<a[^>]+?href="([^"]+)"[^>]+?class="videoplayer"'], 
  79         title 
= self
._og
_search
_title
(webpage
, default
=None) or self
._search
_regex
( 
  80             r
'<title>([^<]+)</title>', webpage
, 'title') 
  81         duration 
= int_or_none(self
._og
_search
_property
( 
  82             'video:duration', webpage
, 'duration', default
=None)) 
  88             'description': self
._og
_search
_description
(webpage
, default
=None), 
  89             'thumbnail': self
._og
_search
_thumbnail
(webpage
, default
=None),