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.

57 lines
2.6 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class SeekerIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?seeker\.com/(?P<display_id>.*)-(?P<article_id>\d+)\.html'
  7. _TESTS = [{
  8. # player.loadRevision3Item
  9. 'url': 'http://www.seeker.com/should-trump-be-required-to-release-his-tax-returns-1833805621.html',
  10. 'md5': '30c1dc4030cc715cf05b423d0947ac18',
  11. 'info_dict': {
  12. 'id': '76243',
  13. 'ext': 'webm',
  14. 'title': 'Should Trump Be Required To Release His Tax Returns?',
  15. 'description': 'Donald Trump has been secretive about his "big," "beautiful" tax returns. So what can we learn if he decides to release them?',
  16. 'uploader': 'Seeker Daily',
  17. 'uploader_id': 'seekerdaily',
  18. }
  19. }, {
  20. 'url': 'http://www.seeker.com/changes-expected-at-zoos-following-recent-gorilla-lion-shootings-1834116536.html',
  21. 'playlist': [
  22. {
  23. 'md5': '83bcd157cab89ad7318dd7b8c9cf1306',
  24. 'info_dict': {
  25. 'id': '67558',
  26. 'ext': 'mp4',
  27. 'title': 'The Pros & Cons Of Zoos',
  28. 'description': 'Zoos are often depicted as a terrible place for animals to live, but is there any truth to this?',
  29. 'uploader': 'DNews',
  30. 'uploader_id': 'dnews',
  31. },
  32. }
  33. ],
  34. 'info_dict': {
  35. 'id': '1834116536',
  36. 'title': 'After Gorilla Killing, Changes Ahead for Zoos',
  37. 'description': 'The largest association of zoos and others are hoping to learn from recent incidents that led to the shooting deaths of a gorilla and two lions.',
  38. },
  39. }]
  40. def _real_extract(self, url):
  41. display_id, article_id = re.match(self._VALID_URL, url).groups()
  42. webpage = self._download_webpage(url, display_id)
  43. mobj = re.search(r"player\.loadRevision3Item\('([^']+)'\s*,\s*(\d+)\);", webpage)
  44. if mobj:
  45. playlist_type, playlist_id = mobj.groups()
  46. return self.url_result(
  47. 'revision3:%s:%s' % (playlist_type, playlist_id), 'Revision3Embed', playlist_id)
  48. else:
  49. entries = [self.url_result('revision3:video_id:%s' % video_id, 'Revision3Embed', video_id) for video_id in re.findall(
  50. r'<iframe[^>]+src=[\'"](?:https?:)?//api\.seekernetwork\.com/player/embed\?videoId=(\d+)', webpage)]
  51. return self.playlist_result(
  52. entries, article_id, self._og_search_title(webpage), self._og_search_description(webpage))