]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/twitcasting.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from ..utils 
import urlencode_postdata
 
  10 class TwitCastingIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://(?:[^/]+\.)?twitcasting\.tv/(?P<uploader_id>[^/]+)/movie/(?P<id>\d+)' 
  13         'url': 'https://twitcasting.tv/ivetesangalo/movie/2357609', 
  14         'md5': '745243cad58c4681dc752490f7540d7f', 
  18             'title': 'Live #2357609', 
  19             'uploader_id': 'ivetesangalo', 
  20             'description': "Moi! I'm live on TwitCasting from my iPhone.", 
  21             'thumbnail': r
're:^https?://.*\.jpg$', 
  24             'skip_download': True, 
  27         'url': 'https://twitcasting.tv/mttbernardini/movie/3689740', 
  31             'title': 'Live playing something #3689740', 
  32             'uploader_id': 'mttbernardini', 
  33             'description': "I'm live on TwitCasting from my iPad. password: abc (Santa Marinella/Lazio, Italia)", 
  34             'thumbnail': r
're:^https?://.*\.jpg$', 
  37             'skip_download': True, 
  38             'videopassword': 'abc', 
  42     def _real_extract(self
, url
): 
  43         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  44         video_id 
= mobj
.group('id') 
  45         uploader_id 
= mobj
.group('uploader_id') 
  47         video_password 
= self
._downloader
.params
.get('videopassword') 
  50             request_data 
= urlencode_postdata({ 
  51                 'password': video_password
, 
  53         webpage 
= self
._download
_webpage
(url
, video_id
, data
=request_data
) 
  55         title 
= self
._html
_search
_regex
( 
  56             r
'(?s)<[^>]+id=["\']movietitle
[^
>]+>(.+?
)</', 
  57             webpage, 'title
', default=None) or self._html_search_meta( 
  58             'twitter
:title
', webpage, fatal=True) 
  60         m3u8_url = self._search_regex( 
  61             (r'data
-movie
-url
=(["\'])(?P<url>(?:(?!\1).)+)\1', 
  62              r'(["\'])(?P
<url
>http
.+?\
.m3u8
.*?
)\
1'), 
  63             webpage, 'm3u8 url
', group='url
') 
  65         formats = self._extract_m3u8_formats( 
  66             m3u8_url, video_id, ext='mp4
', entry_protocol='m3u8_native
', 
  69         thumbnail = self._og_search_thumbnail(webpage) 
  70         description = self._og_search_description( 
  71             webpage, default=None) or self._html_search_meta( 
  72             'twitter
:description
', webpage) 
  77             'description
': description, 
  78             'thumbnail
': thumbnail, 
  79             'uploader_id
': uploader_id,