]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/ridehome.py
[ie/orf:on] Improve extraction (#9677)
[yt-dlp.git] / yt_dlp / extractor / ridehome.py
1 from .art19 import Art19IE
2 from .common import InfoExtractor
3 from ..utils import extract_attributes, get_elements_html_by_class
4 from ..utils.traversal import traverse_obj
5
6
7 class RideHomeIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?ridehome\.info/show/[\w-]+/(?P<id>[\w-]+)/?(?:$|[?#])'
9 _TESTS = [{
10 'url': 'https://www.ridehome.info/show/techmeme-ride-home/thu-1228-will-2024-be-the-year-apple-gets-serious-about-gaming-on-macs/',
11 'info_dict': {
12 'id': 'thu-1228-will-2024-be-the-year-apple-gets-serious-about-gaming-on-macs',
13 },
14 'playlist_count': 1,
15 'playlist': [{
16 'md5': 'c84ea3cc96950a9ab86fe540f3edc588',
17 'info_dict': {
18 'id': '540e5493-9fe6-4c14-a488-dc508d8794b2',
19 'ext': 'mp3',
20 'title': 'Thu. 12/28 – Will 2024 Be The Year Apple Gets Serious About Gaming On Macs?',
21 'description': 'md5:9dba86ae9b5047a8150eceddeeb629c2',
22 'series': 'Techmeme Ride Home',
23 'series_id': '3c30e8f4-ab48-415b-9421-1ae06cd4058b',
24 'upload_date': '20231228',
25 'timestamp': 1703780995,
26 'modified_date': '20231230',
27 'episode_id': '540e5493-9fe6-4c14-a488-dc508d8794b2',
28 'modified_timestamp': 1703912404,
29 'release_date': '20231228',
30 'release_timestamp': 1703782800,
31 'duration': 1000.1502,
32 'thumbnail': r're:^https?://content\.production\.cdn\.art19\.com/images/.*\.jpeg$',
33 },
34 }],
35 }, {
36 'url': 'https://www.ridehome.info/show/techmeme-ride-home/portfolio-profile-sensel-with-ilyarosenberg/',
37 'info_dict': {
38 'id': 'portfolio-profile-sensel-with-ilyarosenberg',
39 },
40 'playlist_count': 1,
41 'playlist': [{
42 'md5': 'bf9d6efad221008ce71aea09d5533cf6',
43 'info_dict': {
44 'id': '6beed803-b1ef-4536-9fef-c23cf6b4dcac',
45 'ext': 'mp3',
46 'title': '(Portfolio Profile) Sensel - With @IlyaRosenberg',
47 'description': 'md5:e1e4a970bce04290e0ba6f030b0125db',
48 'series': 'Techmeme Ride Home',
49 'series_id': '3c30e8f4-ab48-415b-9421-1ae06cd4058b',
50 'upload_date': '20220108',
51 'timestamp': 1641656064,
52 'modified_date': '20230418',
53 'episode_id': '6beed803-b1ef-4536-9fef-c23cf6b4dcac',
54 'modified_timestamp': 1681843318,
55 'release_date': '20220108',
56 'release_timestamp': 1641672000,
57 'duration': 2789.38122,
58 'thumbnail': r're:^https?://content\.production\.cdn\.art19\.com/images/.*\.jpeg$'
59 },
60 }],
61 }, {
62 'url': 'https://www.ridehome.info/show/spacecasts/big-tech-news-apples-macbook-pro-event/',
63 'info_dict': {
64 'id': 'big-tech-news-apples-macbook-pro-event',
65 },
66 'playlist_count': 1,
67 'playlist': [{
68 'md5': 'b1428530c6e03904a8271e978007fc05',
69 'info_dict': {
70 'id': 'f4780044-6c4b-4ce0-8215-8a86cc66bff7',
71 'ext': 'mp3',
72 'title': 'md5:e6c05d44d59b6577a4145ac339de5040',
73 'description': 'md5:14152f7228c8a301a77e3d6bc891b145',
74 'series': 'SpaceCasts',
75 'series_id': '8e3e837d-7fe0-4a23-8e11-894917e07e17',
76 'upload_date': '20211026',
77 'timestamp': 1635271450,
78 'modified_date': '20230502',
79 'episode_id': 'f4780044-6c4b-4ce0-8215-8a86cc66bff7',
80 'modified_timestamp': 1683057500,
81 'release_date': '20211026',
82 'release_timestamp': 1635272124,
83 'duration': 2266.30531,
84 'thumbnail': r're:^https?://content\.production\.cdn\.art19\.com/images/.*\.jpeg$'
85 },
86 }],
87 }]
88
89 def _real_extract(self, url):
90 article_id = self._match_id(url)
91 webpage = self._download_webpage(url, article_id)
92
93 urls = traverse_obj(
94 get_elements_html_by_class('iframeContainer', webpage),
95 (..., {extract_attributes}, lambda k, v: k == 'data-src' and Art19IE.suitable(v)))
96 return self.playlist_from_matches(urls, article_id, ie=Art19IE)