logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

seeker.py (2301B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import (
  6. get_element_by_class,
  7. strip_or_none,
  8. )
  9. class SeekerIE(InfoExtractor):
  10. _VALID_URL = r'https?://(?:www\.)?seeker\.com/(?P<display_id>.*)-(?P<article_id>\d+)\.html'
  11. _TESTS = [{
  12. 'url': 'http://www.seeker.com/should-trump-be-required-to-release-his-tax-returns-1833805621.html',
  13. 'md5': '897d44bbe0d8986a2ead96de565a92db',
  14. 'info_dict': {
  15. 'id': 'Elrn3gnY',
  16. 'ext': 'mp4',
  17. 'title': 'Should Trump Be Required To Release His Tax Returns?',
  18. 'description': 'md5:41efa8cfa8d627841045eec7b018eb45',
  19. 'timestamp': 1490090165,
  20. 'upload_date': '20170321',
  21. }
  22. }, {
  23. 'url': 'http://www.seeker.com/changes-expected-at-zoos-following-recent-gorilla-lion-shootings-1834116536.html',
  24. 'playlist': [
  25. {
  26. 'md5': '0497b9f20495174be73ae136949707d2',
  27. 'info_dict': {
  28. 'id': 'FihYQ8AE',
  29. 'ext': 'mp4',
  30. 'title': 'The Pros & Cons Of Zoos',
  31. 'description': 'md5:d88f99a8ea8e7d25e6ff77f271b1271c',
  32. 'timestamp': 1490039133,
  33. 'upload_date': '20170320',
  34. },
  35. }
  36. ],
  37. 'info_dict': {
  38. 'id': '1834116536',
  39. 'title': 'After Gorilla Killing, Changes Ahead for Zoos',
  40. '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.',
  41. },
  42. }]
  43. def _real_extract(self, url):
  44. display_id, article_id = re.match(self._VALID_URL, url).groups()
  45. webpage = self._download_webpage(url, display_id)
  46. entries = []
  47. for jwp_id in re.findall(r'data-video-id="([a-zA-Z0-9]{8})"', webpage):
  48. entries.append(self.url_result(
  49. 'jwplatform:' + jwp_id, 'JWPlatform', jwp_id))
  50. return self.playlist_result(
  51. entries, article_id,
  52. self._og_search_title(webpage),
  53. strip_or_none(get_element_by_class('subtitle__text', webpage)) or self._og_search_description(webpage))