aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/hark.py
diff options
context:
space:
mode:
authorIsmael Mejia <iemejia@gmail.com>2013-09-06 23:23:23 +0200
committerIsmael Mejia <iemejia@gmail.com>2013-09-06 23:24:41 +0200
commit72836fcee453386f4f16325c5b8fa4c1ba1bb442 (patch)
tree58efd36f4a56269a07774969e2ac385aacf8eae6 /youtube_dl/extractor/hark.py
parentd6e203b3dcef8f291b57021903e629d3e30e1f0b (diff)
parenta7130543fa0368175740f5fa173ef920671db866 (diff)
Merge branch 'master' into subtitles_rework
Diffstat (limited to 'youtube_dl/extractor/hark.py')
-rw-r--r--youtube_dl/extractor/hark.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/youtube_dl/extractor/hark.py b/youtube_dl/extractor/hark.py
new file mode 100644
index 000000000..5bdd08afa
--- /dev/null
+++ b/youtube_dl/extractor/hark.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+import re
+import json
+
+from .common import InfoExtractor
+from ..utils import determine_ext
+
+class HarkIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.hark\.com/clips/(.+?)-.+'
+ _TEST = {
+ u'url': u'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-target-al-qaeda-on-may-23-2013',
+ u'file': u'mmbzyhkgny.mp3',
+ u'md5': u'6783a58491b47b92c7c1af5a77d4cbee',
+ u'info_dict': {
+ u'title': u"Obama: 'Beyond The Afghan Theater, We Only Target Al Qaeda' on May 23, 2013",
+ 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.',
+ u'duration': 11,
+ }
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group(1)
+ json_url = "http://www.hark.com/clips/%s.json" %(video_id)
+ info_json = self._download_webpage(json_url, video_id)
+ info = json.loads(info_json)
+ final_url = info['url']
+
+ return {'id': video_id,
+ 'url' : final_url,
+ 'title': info['name'],
+ 'ext': determine_ext(final_url),
+ 'description': info['description'],
+ 'thumbnail': info['image_original'],
+ 'duration': info['duration'],
+ }