aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/hark.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-08-27 10:25:38 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-08-27 10:25:38 +0200
commit2a7b4da9b2ee11e88976e0e93796fd8460aa053d (patch)
treece3c65666d0e4caf9681ec918bce50f89ec0bc53 /youtube_dl/extractor/hark.py
parent069d098f846ca53073ec646f335f77dac4439844 (diff)
downloadyoutube-dl-2a7b4da9b2ee11e88976e0e93796fd8460aa053d.zip
youtube-dl-2a7b4da9b2ee11e88976e0e93796fd8460aa053d.tar.gz
youtube-dl-2a7b4da9b2ee11e88976e0e93796fd8460aa053d.tar.bz2
[hark] get the song info in JSON and extract more information.
Diffstat (limited to 'youtube_dl/extractor/hark.py')
-rw-r--r--youtube_dl/extractor/hark.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/youtube_dl/extractor/hark.py b/youtube_dl/extractor/hark.py
index ab0a696..5bdd08a 100644
--- a/youtube_dl/extractor/hark.py
+++ b/youtube_dl/extractor/hark.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import re
+import json
from .common import InfoExtractor
from ..utils import determine_ext
@@ -12,24 +13,25 @@ class HarkIE(InfoExtractor):
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'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)
- embed_url = "http://www.hark.com/clips/%s/homepage_embed" %(video_id)
- webpage = self._download_webpage(embed_url, video_id)
-
- final_url = self._search_regex(r'src="(.+?).mp3"',
- webpage, 'video url')+'.mp3'
- title = self._html_search_regex(r'<title>(.+?)</title>',
- webpage, 'video title').replace(' Sound Clip and Quote - Hark','').replace(
- 'Sound Clip , Quote, MP3, and Ringtone - Hark','')
+ 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': title,
+ 'title': info['name'],
'ext': determine_ext(final_url),
+ 'description': info['description'],
+ 'thumbnail': info['image_original'],
+ 'duration': info['duration'],
}