0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-04 23:35:04 +00:00
yt-dlp/youtube_dl/extractor/hark.py

34 lines
1.3 KiB
Python
Raw Normal View History

2013-08-11 17:23:05 +00:00
# -*- coding: utf-8 -*-
2014-10-24 20:31:55 +00:00
from __future__ import unicode_literals
2013-08-11 17:23:05 +00:00
from .common import InfoExtractor
2014-10-24 20:31:55 +00:00
2013-08-11 17:23:05 +00:00
class HarkIE(InfoExtractor):
2014-10-24 20:31:55 +00:00
_VALID_URL = r'https?://www\.hark\.com/clips/(?P<id>.+?)-.+'
2013-08-11 17:23:05 +00:00
_TEST = {
2014-10-24 20:31:55 +00:00
'url': 'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-target-al-qaeda-on-may-23-2013',
'md5': '6783a58491b47b92c7c1af5a77d4cbee',
'info_dict': {
'id': 'mmbzyhkgny',
'ext': 'mp3',
'title': 'Obama: \'Beyond The Afghan Theater, We Only Target Al Qaeda\' on May 23, 2013',
'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.',
'duration': 11,
2013-08-11 17:23:05 +00:00
}
}
def _real_extract(self, url):
2014-10-24 20:31:55 +00:00
video_id = self._match_id(url)
data = self._download_json(
'http://www.hark.com/clips/%s.json' % video_id, video_id)
2013-08-11 17:23:05 +00:00
2014-10-24 20:31:55 +00:00
return {
'id': video_id,
'url': data['url'],
'title': data['name'],
'description': data.get('description'),
'thumbnail': data.get('image_original'),
'duration': data.get('duration'),
}