]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videott.py
   1 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..utils 
import unified_strdate
 
  10 class VideoTtIE(InfoExtractor
): 
  12     IE_DESC 
= 'video.tt - Your True Tube' 
  13     _VALID_URL 
= r
'http://(?:www\.)?video\.tt/(?:video/|watch_video\.php\?v=)(?P<id>[\da-zA-Z]{9})' 
  16         'url': 'http://www.video.tt/watch_video.php?v=amd5YujV8', 
  17         'md5': 'b13aa9e2f267effb5d1094443dff65ba', 
  21             'title': 'Motivational video Change your mind in just 2.50 mins', 
  23             'upload_date': '20130827', 
  24             'uploader': 'joseph313', 
  28     def _real_extract(self
, url
): 
  29         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  30         video_id 
= mobj
.group('id') 
  32         settings 
= self
._download
_json
( 
  33             'http://www.video.tt/player_control/settings.php?v=%s' % video_id
, video_id
, 
  34             'Downloading video JSON')['settings'] 
  36         video 
= settings
['video_details']['video'] 
  40                 'url': base64
.b64decode(res
['u']).decode('utf-8'), 
  42                 'format_id': res
['l'], 
  43             } for res 
in settings
['res'] if res
['u'] 
  48             'title': video
['title'], 
  49             'description': video
['description'], 
  50             'thumbnail': settings
['config']['thumbnail'], 
  51             'upload_date': unified_strdate(video
['added']), 
  52             'uploader': video
['owner'], 
  53             'view_count': int(video
['view_count']), 
  54             'comment_count': int(video
['comment_count']), 
  55             'like_count': int(video
['liked']), 
  56             'dislike_count': int(video
['disliked']),