You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.3 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class HarkIE(InfoExtractor):
  5. _VALID_URL = r'https?://www\.hark\.com/clips/(?P<id>.+?)-.+'
  6. _TEST = {
  7. 'url': 'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-target-al-qaeda-on-may-23-2013',
  8. 'md5': '6783a58491b47b92c7c1af5a77d4cbee',
  9. 'info_dict': {
  10. 'id': 'mmbzyhkgny',
  11. 'ext': 'mp3',
  12. 'title': 'Obama: \'Beyond The Afghan Theater, We Only Target Al Qaeda\' on May 23, 2013',
  13. '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.',
  14. 'duration': 11,
  15. }
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. data = self._download_json(
  20. 'http://www.hark.com/clips/%s.json' % video_id, video_id)
  21. return {
  22. 'id': video_id,
  23. 'url': data['url'],
  24. 'title': data['name'],
  25. 'description': data.get('description'),
  26. 'thumbnail': data.get('image_original'),
  27. 'duration': data.get('duration'),
  28. }