aeonco.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from .common import InfoExtractor
  2. from .vimeo import VimeoIE
  3. class AeonCoIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?aeon\.co/videos/(?P<id>[^/?]+)'
  5. _TESTS = [{
  6. 'url': 'https://aeon.co/videos/raw-solar-storm-footage-is-the-punk-rock-antidote-to-sleek-james-webb-imagery',
  7. 'md5': 'e5884d80552c9b6ea8d268a258753362',
  8. 'info_dict': {
  9. 'id': '1284717',
  10. 'ext': 'mp4',
  11. 'title': 'Brilliant Noise',
  12. 'thumbnail': 'https://i.vimeocdn.com/video/21006315-1a1e49da8b07fd908384a982b4ba9ff0268c509a474576ebdf7b1392f4acae3b-d_960',
  13. 'uploader': 'Semiconductor',
  14. 'uploader_id': 'semiconductor',
  15. 'uploader_url': 'https://vimeo.com/semiconductor',
  16. 'duration': 348
  17. }
  18. }, {
  19. 'url': 'https://aeon.co/videos/dazzling-timelapse-shows-how-microbes-spoil-our-food-and-sometimes-enrich-it',
  20. 'md5': '4e5f3dad9dbda0dbfa2da41a851e631e',
  21. 'info_dict': {
  22. 'id': '728595228',
  23. 'ext': 'mp4',
  24. 'title': 'Wrought',
  25. 'thumbnail': 'https://i.vimeocdn.com/video/1484618528-c91452611f9a4e4497735a533da60d45b2fe472deb0c880f0afaab0cd2efb22a-d_1280',
  26. 'uploader': 'Biofilm Productions',
  27. 'uploader_id': 'user140352216',
  28. 'uploader_url': 'https://vimeo.com/user140352216',
  29. 'duration': 1344
  30. }
  31. }]
  32. def _real_extract(self, url):
  33. video_id = self._match_id(url)
  34. webpage = self._download_webpage(url, video_id)
  35. vimeo_id = self._search_regex(r'hosterId":\s*"(?P<id>[0-9]+)', webpage, 'vimeo id')
  36. vimeo_url = VimeoIE._smuggle_referrer(f'https://player.vimeo.com/video/{vimeo_id}', 'https://aeon.co')
  37. return self.url_result(vimeo_url, VimeoIE)