]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videott.py
   1 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13 class VideoTtIE(InfoExtractor
): 
  15     IE_DESC 
= 'video.tt - Your True Tube' 
  16     _VALID_URL 
= r
'http://(?:www\.)?video\.tt/(?:(?:video|embed)/|watch_video\.php\?v=)(?P<id>[\da-zA-Z]{9})' 
  19         'url': 'http://www.video.tt/watch_video.php?v=amd5YujV8', 
  20         'md5': 'b13aa9e2f267effb5d1094443dff65ba', 
  24             'title': 'Motivational video Change your mind in just 2.50 mins', 
  26             'upload_date': '20130827', 
  27             'uploader': 'joseph313', 
  30         'url': 'http://video.tt/embed/amd5YujV8', 
  31         'only_matching': True, 
  34     def _real_extract(self
, url
): 
  35         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  36         video_id 
= mobj
.group('id') 
  38         settings 
= self
._download
_json
( 
  39             'http://www.video.tt/player_control/settings.php?v=%s' % video_id
, video_id
, 
  40             'Downloading video JSON')['settings'] 
  42         video 
= settings
['video_details']['video'] 
  46                 'url': base64
.b64decode(res
['u']).decode('utf-8'), 
  48                 'format_id': res
['l'], 
  49             } for res 
in settings
['res'] if res
['u'] 
  54             'title': video
['title'], 
  55             'description': video
['description'], 
  56             'thumbnail': settings
['config']['thumbnail'], 
  57             'upload_date': unified_strdate(video
['added']), 
  58             'uploader': video
['owner'], 
  59             'view_count': int_or_none(video
['view_count']), 
  60             'comment_count': None if video
.get('comment_count') == '--' else int_or_none(video
['comment_count']), 
  61             'like_count': int_or_none(video
['liked']), 
  62             'dislike_count': int_or_none(video
['disliked']),