1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
11 class ViddlerIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?viddler\.com/(?:v|embed|player)/(?P<id>[a-z0-9]+)'
14 'url': 'http://www.viddler.com/v/43903784',
15 'md5': 'ae43ad7cb59431ce043f0ff7fa13cbf4',
19 'title': 'Video Made Easy',
20 'description': 'md5:6a697ebd844ff3093bd2e82c37b409cd',
21 'uploader': 'viddler',
22 'timestamp': 1335371429,
23 'upload_date': '20120425',
25 'thumbnail': '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': 'faa71fbf70c0bee7ab93076fd007f4b0',
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': '0defa2bd0ea613d14a6e9bd1db6be326',
49 'title': 'LETeens-Grammar-snack-third-conditional',
51 'upload_date': '20140929',
52 'uploader': 'BCLETeens',
53 'timestamp': 1411997190,
59 def _real_extract(self
, url
):
60 video_id
= self
._match
_id
(url
)
63 'http://api.viddler.com/api/v2/viddler.videos.getPlaybackDetails.json?video_id=%s&key=v0vhrt7bg2xq1vyxhkct' %
65 headers
= {'Referer': 'http://static.cdn-ec.viddler.com/js/arpeggio/v2/embed.html'}
66 request
= sanitized_Request(json_url
, None, headers
)
67 data
= self
._download
_json
(request
, video_id
)['video']
70 for filed
in data
['files']:
71 if filed
.get('status', 'ready') != 'ready':
73 format_id
= filed
.get('profile_id') or filed
['profile_name']
75 'format_id': format_id
,
76 'format_note': filed
['profile_name'],
77 'url': self
._proto
_relative
_url
(filed
['url']),
78 'width': int_or_none(filed
.get('width')),
79 'height': int_or_none(filed
.get('height')),
80 'filesize': int_or_none(filed
.get('size')),
81 'ext': filed
.get('ext'),
82 'source_preference': -1,
86 if filed
.get('cdn_url'):
88 f
['url'] = self
._proto
_relative
_url
(filed
['cdn_url'], 'http:')
89 f
['format_id'] = format_id
+ '-cdn'
90 f
['source_preference'] = 1
93 if filed
.get('html5_video_source'):
95 f
['url'] = self
._proto
_relative
_url
(filed
['html5_video_source'])
96 f
['format_id'] = format_id
+ '-html5'
97 f
['source_preference'] = 0
99 self
._sort
_formats
(formats
)
102 t
.get('text') for t
in data
.get('tags', []) if 'text' in t
]
106 'title': data
['title'],
108 'description': data
.get('description'),
109 'timestamp': int_or_none(data
.get('upload_time')),
110 'thumbnail': self
._proto
_relative
_url
(data
.get('thumbnail_url')),
111 'uploader': data
.get('author'),
112 'duration': float_or_none(data
.get('length')),
113 'view_count': int_or_none(data
.get('view_count')),
114 'comment_count': int_or_none(data
.get('comment_count')),
115 'categories': categories
,