]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/clippit.py
   3 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
  14 class ClippitIE(InfoExtractor
): 
  16     _VALID_URL 
= r
'https?://(?:www\.)?clippituser\.tv/c/(?P<id>[a-z]+)' 
  18         'url': 'https://www.clippituser.tv/c/evmgm', 
  19         'md5': '963ae7a59a2ec4572ab8bf2f2d2c5f09', 
  23             'title': 'Bye bye Brutus. #BattleBots  - Clippit', 
  24             'uploader': 'lizllove', 
  25             'uploader_url': 'https://www.clippituser.tv/p/lizllove', 
  26             'timestamp': 1472183818, 
  27             'upload_date': '20160826', 
  28             'description': 'BattleBots | ABC', 
  29             'thumbnail': r
're:^https?://.*\.jpg$', 
  33     def _real_extract(self
, url
): 
  34         video_id 
= self
._match
_id
(url
) 
  35         webpage 
= self
._download
_webpage
(url
, video_id
) 
  37         title 
= self
._html
_search
_regex
(r
'<title.*>(.+?)</title>', webpage
, 'title') 
  39         FORMATS 
= ('sd', 'hd') 
  40         quality 
= qualities(FORMATS
) 
  42         for format_id 
in FORMATS
: 
  43             url 
= self
._html
_search
_regex
(r
'data-%s-file="(.+?)"' % format_id
, 
  44                                           webpage
, 'url', fatal
=False) 
  47             match 
= re
.search(r
'/(?P<height>\d+)\.mp4', url
) 
  50                 'format_id': format_id
, 
  51                 'quality': quality(format_id
), 
  52                 'height': int(match
.group('height')) if match 
else None, 
  55         uploader 
= self
._html
_search
_regex
(r
'class="username".*>\s+(.+?)\n', 
  56                                            webpage
, 'uploader', fatal
=False) 
  57         uploader_url 
= ('https://www.clippituser.tv/p/' + uploader
 
  58                         if uploader 
else None) 
  60         timestamp 
= self
._html
_search
_regex
(r
'datetime="(.+?)"', 
  61                                             webpage
, 'date', fatal
=False) 
  62         thumbnail 
= self
._html
_search
_regex
(r
'data-image="(.+?)"', 
  63                                             webpage
, 'thumbnail', fatal
=False) 
  70             'uploader_url': uploader_url
, 
  71             'timestamp': parse_iso8601(timestamp
), 
  72             'description': self
._og
_search
_description
(webpage
), 
  73             'thumbnail': thumbnail
,