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

Code before:
            'series': 'The Genius',
            'description': 'md5:db02f1456939ca63f7c408f858044e94',
            'title': 'The Genius',
            'timestamp': 1669062000,
            'creator': 'NED3',
            'episode': 'The Genius',
            'thumbnail': 'https://images.npo.nl/tile/1280x720/1827650.jpg',
            'episode_number': 8,
            'upload_date': '20221121',
        },
        'params': {
            'skip_download': True,
        },
    }]

    @classmethod
    def suitable(cls, url):
        return (False if any(ie.suitable(url)
                for ie in (NPOLiveIE, NPORadioIE, NPORadioFragmentIE))
                else super(NPOIE, cls).suitable(url))

    def _real_extract(self, url):
        video_id = self._match_id(url)

        self._download_json(
            'https://www.npostart.nl/api/token', video_id,
            'Downloading token', headers={
                'Referer': url,
                'X-Requested-With': 'XMLHttpRequest',
            })

        player = self._download_json(
            'https://www.npostart.nl/player/%s' % video_id, video_id,
            'Downloading player JSON', data=urlencode_postdata({
                'autoplay': 0,
                'share': 1,
                'pageUrl': url,
                'hasAdConsent': 0,
            }), headers={
                'x-xsrf-token': try_call(lambda: urllib.parse.unquote(
                    self._get_cookies('https://www.npostart.nl')['XSRF-TOKEN'].value))
            })

        player_token = player['token']

        drm = False
        format_urls = set()
        formats = []
        for profile in ('hls', 'dash-widevine', 'dash-playready', 'smooth'):
            streams = self._download_json(
                'https://start-player.npo.nl/video/%s/streams' % video_id,

Review comment (suggestion):
```suggestion
        self._request_webpage(
            'https://www.npostart.nl/api/token', video_id,
```
There is no read to parse or even read the result if it's not gonna be used

Code after:
        'url': 'https://www.npo3.nl/the-genius/21-11-2022/VPWON_1341105',
        'info_dict': {
            'id': 'VPWON_1341105',
            'ext': 'mp4',
            'duration': 2658,
            'series': 'The Genius',
            'description': 'md5:db02f1456939ca63f7c408f858044e94',
            'title': 'The Genius',
            'timestamp': 1669062000,
            'creator': 'NED3',
            'episode': 'The Genius',
            'thumbnail': 'https://images.npo.nl/tile/1280x720/1827650.jpg',
            'episode_number': 8,
            'upload_date': '20221121',
        },
        'params': {
            'skip_download': True,
        },
    }]

    @classmethod
    def suitable(cls, url):
        return (False if any(ie.suitable(url)
                for ie in (NPOLiveIE, NPORadioIE, NPORadioFragmentIE))
                else super(NPOIE, cls).suitable(url))

    def _real_extract(self, url):
        video_id = self._match_id(url)
        if urllib.parse.urlparse(url).netloc in ['www.ntr.nl', 'ntr.nl']:
            player = self._download_json(
                f'https://www.ntr.nl/ajax/player/embed/{video_id}', video_id,
                'Downloading player JSON', query={
                    'parameters[elementId]': f'npo{random.randint(0, 999)}',
                    'parameters[sterReferralUrl]': url,
                    'parameters[autoplay]': 0,
                })
        else:
            self._request_webpage(
                'https://www.npostart.nl/api/token', video_id,
                'Downloading token', headers={
                    'Referer': url,
                    'X-Requested-With': 'XMLHttpRequest',
                })
            player = self._download_json(
                f'https://www.npostart.nl/player/{video_id}', video_id,
                'Downloading player JSON', data=urlencode_postdata({
                    'autoplay': 0,
                    'share': 1,
                    'pageUrl': url,
                    'hasAdConsent': 0,
                }), headers={