]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dotsub.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
  10 class DotsubIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://(?:www\.)?dotsub\.com/view/(?P<id>[^/]+)' 
  13         'url': 'http://dotsub.com/view/aed3b8b2-1889-4df5-ae63-ad85f5572f27', 
  14         'md5': '0914d4d69605090f623b7ac329fea66e', 
  16             'id': 'aed3b8b2-1889-4df5-ae63-ad85f5572f27', 
  18             'title': 'Pyramids of Waste (2010), AKA The Lightbulb Conspiracy - Planned obsolescence documentary', 
  19             'description': 'md5:699a0f7f50aeec6042cb3b1db2d0d074', 
  20             'thumbnail': 're:^https?://dotsub.com/media/aed3b8b2-1889-4df5-ae63-ad85f5572f27/p', 
  22             'uploader': '4v4l0n42', 
  23             'timestamp': 1292248482.625, 
  24             'upload_date': '20101213', 
  29     def _real_extract(self
, url
): 
  30         video_id 
= self
._match
_id
(url
) 
  32         info 
= self
._download
_json
( 
  33             'https://dotsub.com/api/media/%s/metadata' % video_id
, video_id
) 
  34         video_url 
= info
.get('mediaURI') 
  37             webpage 
= self
._download
_webpage
(url
, video_id
) 
  38             video_url 
= self
._search
_regex
( 
  39                 [r
'<source[^>]+src="([^"]+)"', r
'"file"\s*:\s*\'([^
\']+)'], 
  46             'title
': info['title
'], 
  47             'description
': info.get('description
'), 
  48             'thumbnail
': info.get('screenshotURI
'), 
  49             'duration
': int_or_none(info.get('duration
'), 1000), 
  50             'uploader
': info.get('user
'), 
  51             'timestamp
': float_or_none(info.get('dateCreated
'), 1000), 
  52             'view_count
': int_or_none(info.get('numberOfViews
')),