]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/telemb.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..utils 
import remove_start
 
  10 class TeleMBIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://(?:www\.)?telemb\.be/(?P<display_id>.+?)_d_(?P<id>\d+)\.html' 
  14             'url': 'http://www.telemb.be/mons-cook-with-danielle-des-cours-de-cuisine-en-anglais-_d_13466.html', 
  15             'md5': 'f45ea69878516ba039835794e0f8f783', 
  18                 'display_id': 'mons-cook-with-danielle-des-cours-de-cuisine-en-anglais-', 
  20                 'title': 'Mons - Cook with Danielle : des cours de cuisine en anglais ! - Les reportages', 
  21                 'description': 'md5:bc5225f47b17c309761c856ad4776265', 
  22                 'thumbnail': 're:^http://.*\.(?:jpg|png)$', 
  26             # non-ASCII characters in download URL 
  27             'url': 'http://telemb.be/les-reportages-havre-incendie-mortel_d_13514.html', 
  28             'md5': '6e9682736e5ccd4eab7f21e855350733', 
  31                 'display_id': 'les-reportages-havre-incendie-mortel', 
  33                 'title': 'Havré - Incendie mortel - Les reportages', 
  34                 'description': 'md5:5e54cb449acb029c2b7734e2d946bd4a', 
  35                 'thumbnail': 're:^http://.*\.(?:jpg|png)$', 
  40     def _real_extract(self
, url
): 
  41         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  42         video_id 
= mobj
.group('id') 
  43         display_id 
= mobj
.group('display_id') 
  45         webpage 
= self
._download
_webpage
(url
, display_id
) 
  48         for video_url 
in re
.findall(r
'file\s*:\s*"([^"]+)"', webpage
): 
  51                 'format_id': video_url
.split(':')[0] 
  53             rtmp 
= re
.search(r
'^(?P<url>rtmp://[^/]+/(?P<app>.+))/(?P<playpath>mp4:.+)$', video_url
) 
  56                     'play_path': rtmp
.group('playpath'), 
  57                     'app': rtmp
.group('app'), 
  58                     'player_url': 'http://p.jwpcdn.com/6/10/jwplayer.flash.swf', 
  59                     'page_url': 'http://www.telemb.be', 
  63         self
._sort
_formats
(formats
) 
  65         title 
= remove_start(self
._og
_search
_title
(webpage
), 'TéléMB : ') 
  66         description 
= self
._html
_search
_regex
( 
  67             r
'<meta property="og:description" content="(.+?)" />', 
  68             webpage
, 'description', fatal
=False) 
  69         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) 
  73             'display_id': display_id
, 
  75             'description': description
, 
  76             'thumbnail': thumbnail
,