Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/podchaser.py (Python)

Code before:
            'duration': 3708,
            'timestamp': 1636531259,
            'upload_date': '20211110',
            'rating': 4.0
        }
    }, {
        'url': 'https://www.podchaser.com/podcasts/the-bone-zone-28853',
        'info_dict': {
            'id': '28853',
            'title': 'The Bone Zone',
            'description': 'Podcast by The Bone Zone',
        },
        'playlist_count': 275
    }, {
        'url': 'https://www.podchaser.com/podcasts/sean-carrolls-mindscape-scienc-699349/episodes',
        'info_dict': {
            'id': '699349',
            'title': "Sean Carroll's Mindscape: Science, Society, Philosophy, Culture, Arts, and Ideas",
            'description': 'md5:2cbd8f4749891a84dc8235342e0b5ff1'
        },
        'playlist_mincount': 225
    }]

    def _real_extract(self, url):
        mobj = re.match(self._VALID_URL, url)
        audio_id, podcast_id = mobj.group('id'), mobj.group('podcast_id')

        # If one episode
        if audio_id:
            episodes = [self._download_json("https://api.podchaser.com/episodes/%s" % audio_id, audio_id)]

        # Else get every episode available
        else:
            total_episode_count = self._download_json(
                "https://api.podchaser.com/list/episode", podcast_id,
                headers={'Content-Type': 'application/json;charset=utf-8'},
                data=json.dumps({
                    "filters": {"podcast_id": podcast_id}
                }).encode()).get('total')
            episodes = []
            for i in range(total_episode_count // 100 + 1):
                curr_episodes_data = self._download_json(
                    "https://api.podchaser.com/list/episode", podcast_id,
                    headers={'Content-Type': 'application/json;charset=utf-8'},
                    data=json.dumps({
                        "start": i * 100,
                        "count": 100,
                        "sort_order": "SORT_ORDER_RECENT",
                        "filters": {
                            "podcast_id": podcast_id
                        }, "options": {}

Review comment (suggestion):
```suggestion
        audio_id, podcast_id = self._match_valid_url(url).group('id', 'podcast_id')
```

Code after:
            'duration': 3708,
            'timestamp': 1636531259,
            'upload_date': '20211110',
            'rating': 4.0
        }
    }, {
        'url': 'https://www.podchaser.com/podcasts/the-bone-zone-28853',
        'info_dict': {
            'id': '28853',
            'title': 'The Bone Zone',
            'description': 'Podcast by The Bone Zone',
        },
        'playlist_count': 275
    }, {
        'url': 'https://www.podchaser.com/podcasts/sean-carrolls-mindscape-scienc-699349/episodes',
        'info_dict': {
            'id': '699349',
            'title': 'Sean Carroll\'s Mindscape: Science, Society, Philosophy, Culture, Arts, and Ideas',
            'description': 'md5:2cbd8f4749891a84dc8235342e0b5ff1'
        },
        'playlist_mincount': 225
    }]

    @staticmethod
    def _parse_episode(episode, podcast):
        return {
            'id': str(episode.get('id')),
            'title': episode.get('title'),
            'description': episode.get('description'),
            'url': episode.get('audio_url'),
            'thumbnail': episode.get('image_url'),
            'duration': str_to_int(episode.get('length')),
            'timestamp': unified_timestamp(episode.get('air_date')),
            'rating': float_or_none(episode.get('rating')),
            'categories': list(set(traverse_obj(podcast, (('summary', None), 'categories', ..., 'text')))),
            'tags': traverse_obj(podcast, ('tags', ..., 'text')),
            'series': podcast.get('title'),
        }

    def _call_api(self, path, *args, **kwargs):
        return self._download_json(f'https://api.podchaser.com/{path}', *args, **kwargs)

    def _fetch_page(self, podcast_id, podcast, page):
        json_response = self._call_api(
            'list/episode', podcast_id,
            headers={'Content-Type': 'application/json;charset=utf-8'},
            data=json.dumps({
                'start': page * self._PAGE_SIZE,
                'count': self._PAGE_SIZE,
                'sort_order': 'SORT_ORDER_RECENT',
                'filters': {