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

Code before:
        }
        response = self._download_webpage(self._LOGIN_URL, None, note='Logging in',
                                          data=urlencode_postdata(payload))

        user_has_subscription = self._search_regex(r'user_has_subscription: ["\'](.+?)["\']',
                                                   response, 'subscription_status', default='none')
        if user_has_subscription.lower() == 'true':
            return response
        self._logout()
        if user_has_subscription.lower() == 'false':
            self.raise_login_required('Account is not subscribed')
        else:
            self.raise_login_required('Incorrect username/password')

    def _logout(self):
        self._download_webpage(self._LOGOUT_URL, None, note='Logging out')

    def _real_extract(self, url):
        try:
            self._login()
            webpage = self._download_webpage(url, None, note='Downloading video webpage')
        finally:
            self._logout()

        embed_url = self._search_regex(r'embed_url: ["\'](.+?)["\']', webpage, 'embed_url')
        display_id = self._match_id(url)
        id = self._search_regex(r'embed.vhx.tv/videos/(.+?)\?', embed_url, 'id')
        description = self._html_search_meta('description', webpage, display_name='description', fatal=False)
        thumbnail = self._og_search_thumbnail(webpage)
        thumbnail = thumbnail.split('?')[0] if thumbnail else None  # Ignore crop/downscale
        watch_info = get_element_by_id('watch-info', webpage)
        watch_info = watch_info if watch_info else ''
        title = clean_html(get_element_by_class('video-title', watch_info))
        release_date = self._search_regex(
            r'data-meta-field-name=["\']release_dates["\'] data-meta-field-value=["\'](.+?)["\']',
            watch_info, 'release_date', default=None)  # TODO Really, this should be `fatal=False`, but that angers the tester
        release_date = release_date.replace('-', '') if release_date else None
        # utils.get_element_by_attribute is not used because we want data-meta-field-value,
        # not what's actually in the element (inside is something like "15Dec2021", which
        # is much harder to parse than "2021-12-15")
        series = clean_html(get_element_by_class('series-title', watch_info))
        first_text = get_element_by_class('text', watch_info)
        season_episode = get_element_by_class('site-font-secondary-color', first_text)
        if season_episode:
            season_episode = season_episode.strip()
            season = self._search_regex(r'Season (.+?),', season_episode, 'season', default=None)
            episode = self._search_regex(r'Episode (.+?)', season_episode, 'episode', default=None)
        else:
            season, episode = None

        return {

Review comment (suggestion):
```suggestion
        display_id = self._match_id(url)
        try:
            self._login(display_id)
            webpage = self._download_webpage(url, display_id, note='Downloading video webpage')
        finally:
            self._download_webpage('https://www.dropout.tv/logout', display_id, note='Logging out')

        embed_url = self._search_regex(r'embed_url: ["\'](.+?)["\']', webpage, 'embed_url')
```

Code after:
            }
        },
        {
            'url': 'https://www.dropout.tv/dimension-20-fantasy-high',
            'note': 'Multi-season series with the season not in the url',
            'playlist_count': 17,
            'info_dict': {
                'id': 'dimension-20-fantasy-high-season-1',
                'title': 'Dimension 20 Fantasy High - Season 1'
            }
        },
        {
            'url': 'https://www.dropout.tv/dimension-20-shriek-week',
            'note': 'Single-season series',
            'playlist_count': 4,
            'info_dict': {
                'id': 'dimension-20-shriek-week-season-1',
                'title': 'Dimension 20 Shriek Week - Season 1'
            }
        }
    ]

    def _real_extract(self, url):
        season_id = self._match_id(url)
        season_title = season_id.replace('-', ' ').title()
        webpage = self._download_webpage(url, season_id)

        entries = [
            self.url_result(
                url=self._search_regex(r'<a href=["\'](.+?)["\'] class=["\']browse-item-link["\']',
                                       item, 'item_url'),
                ie=DropoutIE.ie_key()
            ) for item in get_elements_by_class('js-collection-item', webpage)
        ]

        seasons = (get_element_by_class('select-dropdown-wrapper', webpage) or '').strip().replace('\n', '')
        current_season = self._search_regex(r'<option[^>]+selected>([^<]+)</option>',
                                            seasons, 'current_season', default='').strip()

        return {
            '_type': 'playlist',
            'id': join_nonempty(season_id, current_season.lower().replace(' ', '-')),
            'title': join_nonempty(season_title, current_season, delim=' - '),
            'entries': entries
        }