]>
Commit | Line | Data |
---|---|---|
c6989aa3 | 1 | from .common import InfoExtractor |
2 | from .vimeo import VimeoIE | |
ed81b748 | 3 | from ..utils import ExtractorError, traverse_obj, url_or_none |
c6989aa3 | 4 | |
5 | ||
6 | class AeonCoIE(InfoExtractor): | |
7 | _VALID_URL = r'https?://(?:www\.)?aeon\.co/videos/(?P<id>[^/?]+)' | |
8 | _TESTS = [{ | |
9 | 'url': 'https://aeon.co/videos/raw-solar-storm-footage-is-the-punk-rock-antidote-to-sleek-james-webb-imagery', | |
10 | 'md5': 'e5884d80552c9b6ea8d268a258753362', | |
11 | 'info_dict': { | |
12 | 'id': '1284717', | |
13 | 'ext': 'mp4', | |
14 | 'title': 'Brilliant Noise', | |
15 | 'thumbnail': 'https://i.vimeocdn.com/video/21006315-1a1e49da8b07fd908384a982b4ba9ff0268c509a474576ebdf7b1392f4acae3b-d_960', | |
16 | 'uploader': 'Semiconductor', | |
17 | 'uploader_id': 'semiconductor', | |
18 | 'uploader_url': 'https://vimeo.com/semiconductor', | |
19 | 'duration': 348 | |
20 | } | |
21 | }, { | |
22 | 'url': 'https://aeon.co/videos/dazzling-timelapse-shows-how-microbes-spoil-our-food-and-sometimes-enrich-it', | |
ed81b748 | 23 | 'md5': '03582d795382e49f2fd0b427b55de409', |
c6989aa3 | 24 | 'info_dict': { |
ed81b748 | 25 | 'id': '759576926', |
c6989aa3 | 26 | 'ext': 'mp4', |
27 | 'title': 'Wrought', | |
ed81b748 AK |
28 | 'thumbnail': 'https://i.vimeocdn.com/video/1525599692-84614af88e446612f49ca966cf8f80eab2c73376bedd80555741c521c26f9a3e-d_1280', |
29 | 'uploader': 'Aeon Video', | |
30 | 'uploader_id': 'aeonvideo', | |
31 | 'uploader_url': 'https://vimeo.com/aeonvideo', | |
c6989aa3 | 32 | 'duration': 1344 |
33 | } | |
ed81b748 AK |
34 | }, { |
35 | 'url': 'https://aeon.co/videos/chew-over-the-prisoners-dilemma-and-see-if-you-can-find-the-rational-path-out', | |
36 | 'md5': '1cfda0bf3ae24df17d00f2c0cb6cc21b', | |
37 | 'info_dict': { | |
38 | 'id': 'emyi4z-O0ls', | |
39 | 'ext': 'mp4', | |
40 | 'title': 'How to outsmart the Prisoner’s Dilemma - Lucas Husted', | |
41 | 'thumbnail': 'https://i.ytimg.com/vi_webp/emyi4z-O0ls/maxresdefault.webp', | |
42 | 'uploader': 'TED-Ed', | |
43 | 'uploader_id': '@TEDEd', | |
44 | 'uploader_url': 'https://www.youtube.com/@TEDEd', | |
45 | 'duration': 344, | |
46 | 'upload_date': '20200827', | |
47 | 'channel_id': 'UCsooa4yRKGN_zEE8iknghZA', | |
48 | 'playable_in_embed': True, | |
49 | 'description': 'md5:c0959524f08cb60f96fd010f3dfb17f3', | |
50 | 'categories': ['Education'], | |
51 | 'like_count': int, | |
52 | 'channel': 'TED-Ed', | |
53 | 'chapters': 'count:7', | |
54 | 'channel_url': 'https://www.youtube.com/channel/UCsooa4yRKGN_zEE8iknghZA', | |
55 | 'tags': 'count:26', | |
56 | 'availability': 'public', | |
57 | 'channel_follower_count': int, | |
58 | 'view_count': int, | |
59 | 'age_limit': 0, | |
60 | 'live_status': 'not_live', | |
61 | 'comment_count': int, | |
62 | }, | |
c6989aa3 | 63 | }] |
64 | ||
65 | def _real_extract(self, url): | |
66 | video_id = self._match_id(url) | |
67 | webpage = self._download_webpage(url, video_id) | |
ed81b748 AK |
68 | embed_url = traverse_obj(self._yield_json_ld(webpage, video_id), ( |
69 | lambda _, v: v['@type'] == 'VideoObject', 'embedUrl', {url_or_none}), get_all=False) | |
70 | if not embed_url: | |
71 | raise ExtractorError('No embed URL found in webpage') | |
72 | if 'player.vimeo.com' in embed_url: | |
73 | embed_url = VimeoIE._smuggle_referrer(embed_url, 'https://aeon.co/') | |
74 | return self.url_result(embed_url) |