]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/twitcasting.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   9 class TwitCastingIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'https?://(?:[^/]+\.)?twitcasting\.tv/(?P<uploader_id>[^/]+)/movie/(?P<id>\d+)' 
  12         'url': 'https://twitcasting.tv/ivetesangalo/movie/2357609', 
  13         'md5': '745243cad58c4681dc752490f7540d7f', 
  17             'title': 'Recorded Live #2357609', 
  18             'uploader_id': 'ivetesangalo', 
  19             'description': "Moi! I'm live on TwitCasting from my iPhone.", 
  20             'thumbnail': r
're:^https?://.*\.jpg$', 
  23             'skip_download': True, 
  27     def _real_extract(self
, url
): 
  28         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  29         video_id 
= mobj
.group('id') 
  30         uploader_id 
= mobj
.group('uploader_id') 
  32         webpage 
= self
._download
_webpage
(url
, video_id
) 
  34         title 
= self
._html
_search
_regex
( 
  35             r
'(?s)<[^>]+id=["\']movietitle
[^
>]+>(.+?
)</', 
  36             webpage, 'title
', default=None) or self._html_search_meta( 
  37             'twitter
:title
', webpage, fatal=True) 
  39         m3u8_url = self._search_regex( 
  40             (r'data
-movie
-url
=(["\'])(?P<url>(?:(?!\1).)+)\1', 
  41              r'(["\'])(?P
<url
>http
.+?\
.m3u8
.*?
)\
1'), 
  42             webpage, 'm3u8 url
', group='url
') 
  44         formats = self._extract_m3u8_formats( 
  45             m3u8_url, video_id, ext='mp4
', entry_protocol='m3u8_native
', 
  48         thumbnail = self._og_search_thumbnail(webpage) 
  49         description = self._og_search_description( 
  50             webpage, default=None) or self._html_search_meta( 
  51             'twitter
:description
', webpage) 
  56             'description
': description, 
  57             'thumbnail
': thumbnail, 
  58             'uploader_id
': uploader_id,