]>
Commit | Line | Data |
---|---|---|
e3a88568 Y |
1 | # -*- coding: utf-8 -*- |
2 | ||
3 | import re | |
2a7b4da9 | 4 | import json |
e3a88568 Y |
5 | |
6 | from .common import InfoExtractor | |
7 | from ..utils import determine_ext | |
8 | ||
9 | class HarkIE(InfoExtractor): | |
10 | _VALID_URL = r'https?://www\.hark\.com/clips/(.+?)-.+' | |
11 | _TEST = { | |
12 | u'url': u'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-target-al-qaeda-on-may-23-2013', | |
13 | u'file': u'mmbzyhkgny.mp3', | |
14 | u'md5': u'6783a58491b47b92c7c1af5a77d4cbee', | |
15 | u'info_dict': { | |
2a7b4da9 JMF |
16 | u'title': u"Obama: 'Beyond The Afghan Theater, We Only Target Al Qaeda' on May 23, 2013", |
17 | u'description': u'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.', | |
18 | u'duration': 11, | |
e3a88568 Y |
19 | } |
20 | } | |
21 | ||
22 | def _real_extract(self, url): | |
23 | mobj = re.match(self._VALID_URL, url) | |
24 | video_id = mobj.group(1) | |
2a7b4da9 JMF |
25 | json_url = "http://www.hark.com/clips/%s.json" %(video_id) |
26 | info_json = self._download_webpage(json_url, video_id) | |
27 | info = json.loads(info_json) | |
28 | final_url = info['url'] | |
e3a88568 Y |
29 | |
30 | return {'id': video_id, | |
31 | 'url' : final_url, | |
2a7b4da9 | 32 | 'title': info['name'], |
e3a88568 | 33 | 'ext': determine_ext(final_url), |
2a7b4da9 JMF |
34 | 'description': info['description'], |
35 | 'thumbnail': info['image_original'], | |
36 | 'duration': info['duration'], | |
e3a88568 | 37 | } |