1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
13 class ViddlerIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?viddler\.com/(?:v|embed|player)/(?P<id>[a-z0-9]+)'
16 "url": "http://www.viddler.com/v/43903784",
17 'md5': 'ae43ad7cb59431ce043f0ff7fa13cbf4',
21 "title": "Video Made Easy",
22 'description': 'You don\'t need to be a professional to make high-quality video content. Viddler provides some quick and easy tips on how to produce great video content with limited resources. ',
23 "uploader": "viddler",
24 'timestamp': 1335371429,
25 'upload_date': '20120425',
27 'thumbnail': 're:^https?://.*\.jpg$',
29 'categories': ['video content', 'high quality video', 'video made easy', 'how to produce video with limited resources', 'viddler'],
32 "url": "http://www.viddler.com/v/4d03aad9/",
33 "file": "4d03aad9.mp4",
34 "md5": "faa71fbf70c0bee7ab93076fd007f4b0",
36 'upload_date': '20150126',
37 'uploader': 'deadspin',
39 'timestamp': 1422285291,
40 'title': 'WALL-TO-GORTAT',
43 "url": "http://www.viddler.com/player/221ebbbd/0/",
44 "file": "221ebbbd.mp4",
45 "md5": "0defa2bd0ea613d14a6e9bd1db6be326",
47 'upload_date': '20140929',
48 'uploader': 'BCLETeens',
50 'timestamp': 1411997190,
51 'title': 'LETeens-Grammar-snack-third-conditional',
56 def _real_extract(self
, url
):
57 video_id
= self
._match
_id
(url
)
60 'http://api.viddler.com/api/v2/viddler.videos.getPlaybackDetails.json?video_id=%s&key=v0vhrt7bg2xq1vyxhkct' %
62 headers
= {'Referer': 'http://static.cdn-ec.viddler.com/js/arpeggio/v2/embed.html'}
63 request
= compat_urllib_request
.Request(json_url
, None, headers
)
64 data
= self
._download
_json
(request
, video_id
)['video']
67 for filed
in data
['files']:
68 if filed
.get('status', 'ready') != 'ready':
71 'format_id': filed
['profile_id'],
72 'format_note': filed
['profile_name'],
73 'url': self
._proto
_relative
_url
(filed
['url']),
74 'width': int_or_none(filed
.get('width')),
75 'height': int_or_none(filed
.get('height')),
76 'filesize': int_or_none(filed
.get('size')),
77 'ext': filed
.get('ext'),
78 'source_preference': -1,
82 if filed
.get('cdn_url'):
84 f
['url'] = self
._proto
_relative
_url
(filed
['cdn_url'], 'http:')
85 f
['format_id'] = filed
['profile_id'] + '-cdn'
86 f
['source_preference'] = 1
89 if filed
.get('html5_video_source'):
91 f
['url'] = self
._proto
_relative
_url
(
92 filed
['html5_video_source'])
93 f
['format_id'] = filed
['profile_id'] + '-html5'
94 f
['source_preference'] = 0
96 self
._sort
_formats
(formats
)
99 t
.get('text') for t
in data
.get('tags', []) if 'text' in t
]
104 'title': data
['title'],
106 'description': data
.get('description'),
107 'timestamp': int_or_none(data
.get('upload_time')),
108 'thumbnail': self
._proto
_relative
_url
(data
.get('thumbnail_url')),
109 'uploader': data
.get('author'),
110 'duration': float_or_none(data
.get('length')),
111 'view_count': int_or_none(data
.get('view_count')),
112 'categories': categories
,