1 from .common
import InfoExtractor
7 from ..utils
.traversal
import traverse_obj
10 class ApplePodcastsIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://podcasts\.apple\.com/(?:[^/]+/)?podcast(?:/[^/]+){1,2}.*?\bi=(?P<id>\d+)'
13 'url': 'https://podcasts.apple.com/us/podcast/ferreck-dawn-to-the-break-of-dawn-117/id1625658232?i=1000665010654',
14 'md5': '82cc219b8cc1dcf8bfc5a5e99b23b172',
16 'id': '1000665010654',
18 'title': 'Ferreck Dawn - To The Break of Dawn 117',
19 'episode': 'Ferreck Dawn - To The Break of Dawn 117',
20 'description': 'md5:1fc571102f79dbd0a77bfd71ffda23bc',
21 'upload_date': '20240812',
22 'timestamp': 1723449600,
24 'series': 'Ferreck Dawn - To The Break of Dawn',
25 'thumbnail': 're:.+[.](png|jpe?g|webp)',
28 'url': 'https://podcasts.apple.com/us/podcast/207-whitney-webb-returns/id1135137367?i=1000482637777',
29 'md5': 'baf8a6b8b8aa6062dbb4639ed73d0052',
31 'id': '1000482637777',
33 'title': '207 - Whitney Webb Returns',
34 'episode': '207 - Whitney Webb Returns',
35 'episode_number': 207,
36 'description': 'md5:75ef4316031df7b41ced4e7b987f79c6',
37 'upload_date': '20200705',
38 'timestamp': 1593932400,
40 'series': 'The Tim Dillon Show',
41 'thumbnail': 're:.+[.](png|jpe?g|webp)',
44 'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns/id1135137367?i=1000482637777',
45 'only_matching': True,
47 'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns?i=1000482637777',
48 'only_matching': True,
50 'url': 'https://podcasts.apple.com/podcast/id1135137367?i=1000482637777',
51 'only_matching': True,
54 def _real_extract(self
, url
):
55 episode_id
= self
._match
_id
(url
)
56 webpage
= self
._download
_webpage
(url
, episode_id
)
57 server_data
= self
._search
_json
(
58 r
'<script [^>]*\bid=["\']serialized
-server
-data
["\'][^>]*>', webpage,
59 'server data', episode_id, contains_pattern=r'\[{(?s:.+)}\]')[0]['data']
60 model_data = traverse_obj(server_data, (
61 'headerButtonItems', lambda _, v: v['$kind'] == 'bookmark' and v['modelType'] == 'EpisodeOffer',
62 'model', {dict}, any))
67 traverse_obj(server_data, ('seoData', 'schemaContent', {dict}))
68 or self._yield_json_ld(webpage, episode_id, fatal=False), episode_id, fatal=False),
69 **traverse_obj(model_data, {
70 'title': ('title', {str}),
71 'url': ('streamUrl', {clean_podcast_url}),
72 'timestamp': ('releaseDate', {parse_iso8601}),
73 'duration': ('duration', {int_or_none}),
75 'thumbnail': self._og_search_thumbnail(webpage),