]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/viddler.py
1 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class ViddlerIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?viddler\.com/(?:v|embed|player)/(?P<id>[a-z0-9]+)(?:.+?\bsecret=(\d+))?'
14 'url': 'http://www.viddler.com/v/43903784',
15 'md5': '9eee21161d2c7f5b39690c3e325fab2f',
19 'title': 'Video Made Easy',
20 'description': 'md5:6a697ebd844ff3093bd2e82c37b409cd',
21 'uploader': 'viddler',
22 'timestamp': 1335371429,
23 'upload_date': '20120425',
25 'thumbnail': r
're:^https?://.*\.jpg$',
28 'categories': ['video content', 'high quality video', 'video made easy', 'how to produce video with limited resources', 'viddler'],
31 'url': 'http://www.viddler.com/v/4d03aad9/',
32 'md5': 'f12c5a7fa839c47a79363bfdf69404fb',
36 'title': 'WALL-TO-GORTAT',
37 'upload_date': '20150126',
38 'uploader': 'deadspin',
39 'timestamp': 1422285291,
44 'url': 'http://www.viddler.com/player/221ebbbd/0/',
45 'md5': '740511f61d3d1bb71dc14a0fe01a1c10',
49 'title': 'LETeens-Grammar-snack-third-conditional',
51 'upload_date': '20140929',
52 'uploader': 'BCLETeens',
53 'timestamp': 1411997190,
59 'url': 'http://www.viddler.com/v/890c0985?secret=34051570',
63 'title': 'Complete Property Training - Traineeships',
65 'upload_date': '20130606',
66 'uploader': 'TiffanyBowtell',
67 'timestamp': 1370496993,
72 'skip_download': True,
76 def _real_extract(self
, url
):
77 video_id
, secret
= self
._match
_valid
_url
(url
).groups()
81 'key': 'v0vhrt7bg2xq1vyxhkct',
84 query
['secret'] = secret
86 data
= self
._download
_json
(
87 'http://api.viddler.com/api/v2/viddler.videos.getPlaybackDetails.json',
88 video_id
, headers
={'Referer': url}
, query
=query
)['video']
91 for filed
in data
['files']:
92 if filed
.get('status', 'ready') != 'ready':
94 format_id
= filed
.get('profile_id') or filed
['profile_name']
96 'format_id': format_id
,
97 'format_note': filed
['profile_name'],
98 'url': self
._proto
_relative
_url
(filed
['url']),
99 'width': int_or_none(filed
.get('width')),
100 'height': int_or_none(filed
.get('height')),
101 'filesize': int_or_none(filed
.get('size')),
102 'ext': filed
.get('ext'),
103 'source_preference': -1,
107 if filed
.get('cdn_url'):
109 f
['url'] = self
._proto
_relative
_url
(filed
['cdn_url'], 'http:')
110 f
['format_id'] = format_id
+ '-cdn'
111 f
['source_preference'] = 1
114 if filed
.get('html5_video_source'):
116 f
['url'] = self
._proto
_relative
_url
(filed
['html5_video_source'])
117 f
['format_id'] = format_id
+ '-html5'
118 f
['source_preference'] = 0
120 self
._sort
_formats
(formats
)
123 t
.get('text') for t
in data
.get('tags', []) if 'text' in t
]
127 'title': data
['title'],
129 'description': data
.get('description'),
130 'timestamp': int_or_none(data
.get('upload_time')),
131 'thumbnail': self
._proto
_relative
_url
(data
.get('thumbnail_url')),
132 'uploader': data
.get('author'),
133 'duration': float_or_none(data
.get('length')),
134 'view_count': int_or_none(data
.get('view_count')),
135 'comment_count': int_or_none(data
.get('comment_count')),
136 'categories': categories
,