]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/hark.py
Merge tag 'upstream/2015.02.28'
[youtubedl] / youtube_dl / extractor / hark.py
1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class HarkIE(InfoExtractor):
8 _VALID_URL = r'https?://www\.hark\.com/clips/(?P<id>.+?)-.+'
9 _TEST = {
10 'url': 'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-target-al-qaeda-on-may-23-2013',
11 'md5': '6783a58491b47b92c7c1af5a77d4cbee',
12 'info_dict': {
13 'id': 'mmbzyhkgny',
14 'ext': 'mp3',
15 'title': 'Obama: \'Beyond The Afghan Theater, We Only Target Al Qaeda\' on May 23, 2013',
16 'description': 'President Barack Obama addressed the nation live on May 23, 2013 in a speech aimed at addressing counter-terrorism policies including the use of drone strikes, detainees at Guantanamo Bay prison facility, and American citizens who are terrorists.',
17 'duration': 11,
18 }
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 data = self._download_json(
24 'http://www.hark.com/clips/%s.json' % video_id, video_id)
25
26 return {
27 'id': video_id,
28 'url': data['url'],
29 'title': data['name'],
30 'description': data.get('description'),
31 'thumbnail': data.get('image_original'),
32 'duration': data.get('duration'),
33 }