]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/viddler.py
1 from .common
import InfoExtractor
8 class ViddlerIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?viddler\.com/(?:v|embed|player)/(?P<id>[a-z0-9]+)(?:.+?\bsecret=(\d+))?'
11 'url': 'http://www.viddler.com/v/43903784',
12 'md5': '9eee21161d2c7f5b39690c3e325fab2f',
16 'title': 'Video Made Easy',
17 'description': 'md5:6a697ebd844ff3093bd2e82c37b409cd',
18 'uploader': 'viddler',
19 'timestamp': 1335371429,
20 'upload_date': '20120425',
22 'thumbnail': r
're:^https?://.*\.jpg$',
25 'categories': ['video content', 'high quality video', 'video made easy', 'how to produce video with limited resources', 'viddler'],
28 'url': 'http://www.viddler.com/v/4d03aad9/',
29 'md5': 'f12c5a7fa839c47a79363bfdf69404fb',
33 'title': 'WALL-TO-GORTAT',
34 'upload_date': '20150126',
35 'uploader': 'deadspin',
36 'timestamp': 1422285291,
41 'url': 'http://www.viddler.com/player/221ebbbd/0/',
42 'md5': '740511f61d3d1bb71dc14a0fe01a1c10',
46 'title': 'LETeens-Grammar-snack-third-conditional',
48 'upload_date': '20140929',
49 'uploader': 'BCLETeens',
50 'timestamp': 1411997190,
56 'url': 'http://www.viddler.com/v/890c0985?secret=34051570',
60 'title': 'Complete Property Training - Traineeships',
62 'upload_date': '20130606',
63 'uploader': 'TiffanyBowtell',
64 'timestamp': 1370496993,
69 'skip_download': True,
73 def _real_extract(self
, url
):
74 video_id
, secret
= self
._match
_valid
_url
(url
).groups()
78 'key': 'v0vhrt7bg2xq1vyxhkct',
81 query
['secret'] = secret
83 data
= self
._download
_json
(
84 'http://api.viddler.com/api/v2/viddler.videos.getPlaybackDetails.json',
85 video_id
, headers
={'Referer': url}
, query
=query
)['video']
88 for filed
in data
['files']:
89 if filed
.get('status', 'ready') != 'ready':
91 format_id
= filed
.get('profile_id') or filed
['profile_name']
93 'format_id': format_id
,
94 'format_note': filed
['profile_name'],
95 'url': self
._proto
_relative
_url
(filed
['url']),
96 'width': int_or_none(filed
.get('width')),
97 'height': int_or_none(filed
.get('height')),
98 'filesize': int_or_none(filed
.get('size')),
99 'ext': filed
.get('ext'),
100 'source_preference': -1,
104 if filed
.get('cdn_url'):
106 f
['url'] = self
._proto
_relative
_url
(filed
['cdn_url'], 'http:')
107 f
['format_id'] = format_id
+ '-cdn'
108 f
['source_preference'] = 1
111 if filed
.get('html5_video_source'):
113 f
['url'] = self
._proto
_relative
_url
(filed
['html5_video_source'])
114 f
['format_id'] = format_id
+ '-html5'
115 f
['source_preference'] = 0
117 self
._sort
_formats
(formats
)
120 t
.get('text') for t
in data
.get('tags', []) if 'text' in t
]
124 'title': data
['title'],
126 'description': data
.get('description'),
127 'timestamp': int_or_none(data
.get('upload_time')),
128 'thumbnail': self
._proto
_relative
_url
(data
.get('thumbnail_url')),
129 'uploader': data
.get('author'),
130 'duration': float_or_none(data
.get('length')),
131 'view_count': int_or_none(data
.get('view_count')),
132 'comment_count': int_or_none(data
.get('comment_count')),
133 'categories': categories
,