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

Code before:
        'info_dict': {
            'id': 'thursday-april-24-2025',
            'thumbnail': r're:^https://.*\.(jpg|png)',
            'title': 'Thursday, April 24, 2025',
            'creators': ['Lester Holt, NBC News'],
            'description': '<p>Trump urges Putin to \'STOP\' after deadly Russian strike on Ukraine; More than 90,000 people have paid their respects to Pope Francis; Miami shooting leaves three injured; and more on tonight’s broadcast.</p>',
            'duration': 1250,
            'ext': 'mp3',
        },
    }, {
        'url': 'https://player.fm/series/soccer-101/ep-109-its-kicking-off-how-have-the-rules-for-kickoff-changed-what-are-the-best-approaches-to-getting-the-game-underway-and-how-could-we-improve-on-the-present-system',
        'info_dict': {
            'id': 'ep-109-its-kicking-off-how-have-the-rules-for-kickoff-changed-what-are-the-best-approaches-to-getting-the-game-underway-and-how-could-we-improve-on-the-present-system',
            'thumbnail': r're:^https://.*\.(jpg|png)',
            'title': '#109 It\'s kicking off! How have the rules for kickoff changed, what are the best approaches to getting the game underway, and how could we improve on the present system?',
            'creators': ['TSS'],
            'description': '<p>Ryan is joined by Joe and Taylor to answer the age old question (in your best Jerry Seinfeld impression), "What\'s the deal with kickoff?!" How does a game get underway, how have the rules regarding kickoff evolved since the mid-1800s, what are the different approaches to getting your tactics right from kickoff, how could we improve upon the current system, and much much more!</p><p>The Soccer 101 theme, and plenty of other excellent music, can be found right here: <a href="https://aerialist.bandcamp.com/">https://aerialist.bandcamp.com</a>.</p>',
            'duration': 1765,
            'ext': 'mp3',
        },
    }]

    def _real_extract(self, url):
        # podcast url is always after last backlash
        video_id = self._match_id(url)
        data = self._download_json(url + '.json', None)

        title = data.get('title')
        description = data.get('description')
        duration = data.get('duration')
        thumbnail = traverse_obj(data, ('image', 'url'), ('series', 'image', 'url'))
        creators = [traverse_obj(data, ('series', 'author'))]

        video_url = join_nonempty('https', self._search_regex(r'redirect.mp3/(.*)', data['url'], 'redirect'), delim='://')
        if not video_url:
            raise ExtractorError('URL to podcast not found', expected=True)
        formats = [{
            'url': video_url,
            'ext': determine_ext(video_url, default_ext=''),
        }]
        return {
            'id': video_id,
            'thumbnail': thumbnail,
            'title': title,
            'creators': creators,
            'description': description,
            'duration': duration,
            'formats': formats,
        }


Review comment (suggestion):
The input url may have a query or a fragment (or more path segments!), so we can't just add `.json` to it.

We'll want to use the `url` capture group added in my above suggestion:
```suggestion
        # podcast url is always after last backlash
        video_id, url = self._match_valid_url(url).group('id', 'url')
        data = self._download_json(url + '.json', video_id)
```

Code after:
    }, {
        'url': 'https://player.fm/series/nbc-nightly-news-with-tom-llamas/thursday-april-17-2025',
        'info_dict': {
            'ext': 'mp3',
            'id': '477635490',
            'display_id': 'thursday-april-17-2025',
            'title': 'Thursday, April 17, 2025',
            'thumbnail': r're:^https://.*\.(jpg|png)',
            'duration': 1143,
            'description': 'md5:4890b8cf9a55a787561cd5d59dfcda82',
            'creators': ['NBC News'],
            'timestamp': 1744941374,
            'upload_date': '20250418',
        },
    }, {
        'url': 'https://player.fm/series/soccer-101/ep-109-its-kicking-off-how-have-the-rules-for-kickoff-changed-what-are-the-best-approaches-to-getting-the-game-underway-and-how-could-we-improve-on-the-present-system-ack3NzL3yibvs4pf',
        'info_dict': {
            'ext': 'mp3',
            'id': '481418710',
            'thumbnail': r're:^https://.*\.(jpg|png)',
            'title': r're:#109 It\'s kicking off! How have the rules for kickoff changed, .+ the present system\?',
            'creators': ['TSS'],
            'duration': 1510,
            'display_id': 'md5:b52ecacaefab891b59db69721bfd9b13',
            'description': 'md5:52a39e36d08d8919527454f152ad3c25',
            'timestamp': 1659102055,
            'upload_date': '20220729',
        },
    }]

    def _real_extract(self, url):
        display_id, url = self._match_valid_url(url).group('id', 'url')
        data = self._download_json(f'{url}.json', display_id)

        return {
            'display_id': display_id,
            'vcodec': 'none',
            **traverse_obj(data, {
                'id': ('id', {int}, {str_or_none}),
                'url': ('url', {clean_podcast_url}),
                'title': ('title', {str}),
                'description': ('description', {clean_html}),
                'duration': ('duration', {int_or_none}),
                'thumbnail': (('image', ('series', 'image')), 'url', {url_or_none}, any),
                'filesize': ('size', {int_or_none}),
                'timestamp': ('publishedAt', {int_or_none}),
                'creators': ('series', 'author', {str}, filter, all, filter),
            }),
        }