3 from .common
import InfoExtractor
12 class GooglePodcastsBaseIE(InfoExtractor
):
13 _VALID_URL_BASE
= r
'https?://podcasts\.google\.com/feed/'
15 def _batch_execute(self
, func_id
, video_id
, params
):
16 return json
.loads(self
._download
_json
(
17 'https://podcasts.google.com/_/PodcastsUi/data/batchexecute',
18 video_id
, data
=urlencode_postdata({
19 'f.req': json
.dumps([[[func_id
, json
.dumps(params
), None, '1']]]),
20 }), transform_source
=lambda x
: self
._search
_regex
(r
'(?s)(\[.+\])', x
, 'data'))[0][2])
22 def _extract_episode(self
, episode
):
26 'url': clean_podcast_url(episode
[13]),
27 'thumbnail': episode
[2],
28 'description': episode
[9],
29 'creator': try_get(episode
, lambda x
: x
[14]),
30 'timestamp': int_or_none(episode
[11]),
31 'duration': int_or_none(episode
[12]),
36 class GooglePodcastsIE(GooglePodcastsBaseIE
):
37 IE_NAME
= 'google:podcasts'
38 _VALID_URL
= GooglePodcastsBaseIE
._VALID
_URL
_BASE
+ r
'(?P<feed_url>[^/]+)/episode/(?P<id>[^/?&#]+)'
40 'url': 'https://podcasts.google.com/feed/aHR0cHM6Ly9mZWVkcy5ucHIub3JnLzM0NDA5ODUzOS9wb2RjYXN0LnhtbA/episode/MzBlNWRlN2UtOWE4Yy00ODcwLTk2M2MtM2JlMmUyNmViOTRh',
41 'md5': 'fa56b2ee8bd0703e27e42d4b104c4766',
43 'id': '30e5de7e-9a8c-4870-963c-3be2e26eb94a',
45 'title': 'WWDTM New Year 2021',
46 'description': 'We say goodbye to 2020 with Christine Baranksi, Doug Jones, Jonna Mendez, and Kellee Edwards.',
47 'upload_date': '20210102',
48 'timestamp': 1609606800,
50 'series': "Wait Wait... Don't Tell Me!",
54 def _real_extract(self
, url
):
55 b64_feed_url
, b64_guid
= self
._match
_valid
_url
(url
).groups()
56 episode
= self
._batch
_execute
(
57 'oNjqVe', b64_guid
, [b64_feed_url
, b64_guid
])[1]
58 return self
._extract
_episode
(episode
)
61 class GooglePodcastsFeedIE(GooglePodcastsBaseIE
):
62 IE_NAME
= 'google:podcasts:feed'
63 _VALID_URL
= GooglePodcastsBaseIE
._VALID
_URL
_BASE
+ r
'(?P<id>[^/?&#]+)/?(?:[?#&]|$)'
65 'url': 'https://podcasts.google.com/feed/aHR0cHM6Ly9mZWVkcy5ucHIub3JnLzM0NDA5ODUzOS9wb2RjYXN0LnhtbA',
67 'title': "Wait Wait... Don't Tell Me!",
68 'description': "NPR's weekly current events quiz. Have a laugh and test your news knowledge while figuring out what's real and what we've made up.",
70 'playlist_mincount': 20,
73 def _real_extract(self
, url
):
74 b64_feed_url
= self
._match
_id
(url
)
75 data
= self
._batch
_execute
('ncqJEe', b64_feed_url
, [b64_feed_url
])
78 for episode
in (try_get(data
, lambda x
: x
[1][0]) or []):
79 entries
.append(self
._extract
_episode
(episode
))
81 feed
= try_get(data
, lambda x
: x
[3]) or []
82 return self
.playlist_result(
83 entries
, playlist_title
=try_get(feed
, lambda x
: x
[0]),
84 playlist_description
=try_get(feed
, lambda x
: x
[2]))