logo

youtube-dl

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

spiegel.py (2383B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from .jwplatform import JWPlatformIE
  5. class SpiegelIE(InfoExtractor):
  6. _UUID_RE = r'[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}'
  7. _VALID_URL = r'https?://(?:www\.)?(?:spiegel|manager-magazin)\.de(?:/[^/]+)+/[^/]*-(?P<id>[0-9]+|%s)(?:-embed|-iframe)?(?:\.html)?(?:#.*)?$' % _UUID_RE
  8. _TESTS = [{
  9. 'url': 'http://www.spiegel.de/video/vulkan-tungurahua-in-ecuador-ist-wieder-aktiv-video-1259285.html',
  10. 'md5': '50c7948883ec85a3e431a0a44b7ad1d6',
  11. 'info_dict': {
  12. 'id': 'II0BUyxY',
  13. 'display_id': '1259285',
  14. 'ext': 'mp4',
  15. 'title': 'Vulkan Tungurahua in Ecuador ist wieder aktiv - DER SPIEGEL - Wissenschaft',
  16. 'description': 'md5:8029d8310232196eb235d27575a8b9f4',
  17. 'duration': 48.0,
  18. 'upload_date': '20130311',
  19. 'timestamp': 1362997920,
  20. },
  21. }, {
  22. 'url': 'http://www.spiegel.de/video/schach-wm-videoanalyse-des-fuenften-spiels-video-1309159.html',
  23. 'only_matching': True,
  24. }, {
  25. 'url': 'https://www.spiegel.de/video/eifel-zoo-aufregung-um-ausgebrochene-raubtiere-video-99018031.html',
  26. 'only_matching': True,
  27. }, {
  28. 'url': 'https://www.spiegel.de/panorama/urteile-im-goldmuenzenprozess-haftstrafen-fuer-clanmitglieder-a-aae8df48-43c1-4c61-867d-23f0a2d254b7',
  29. 'only_matching': True,
  30. }, {
  31. 'url': 'http://www.spiegel.de/video/spiegel-tv-magazin-ueber-guellekrise-in-schleswig-holstein-video-99012776.html',
  32. 'only_matching': True,
  33. }, {
  34. 'url': 'http://www.spiegel.de/sport/sonst/badminton-wm-die-randsportart-soll-populaerer-werden-a-987092.html',
  35. 'only_matching': True,
  36. }]
  37. def _real_extract(self, url):
  38. video_id = self._match_id(url)
  39. webpage = self._download_webpage(url, video_id)
  40. media_id = self._html_search_regex(
  41. r'(&#34;|["\'])mediaId\1\s*:\s*(&#34;|["\'])(?P<id>(?:(?!\2).)+)\2',
  42. webpage, 'media id', group='id')
  43. return {
  44. '_type': 'url_transparent',
  45. 'id': video_id,
  46. 'display_id': video_id,
  47. 'url': 'jwplatform:%s' % media_id,
  48. 'title': self._og_search_title(webpage, default=None),
  49. 'ie_key': JWPlatformIE.ie_key(),
  50. }