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

Code before:
        app_id = self._match_id(url)

        self._set_cookie('store.steampowered.com', 'wants_mature_content', '1')
        self._set_cookie('store.steampowered.com', 'birthtime', '946652401')
        self._set_cookie('store.steampowered.com', 'lastagecheckage', '1-January-2000')

        webpage = self._download_webpage(url, app_id)
        app_name = traverse_obj(webpage, ({find_element(cls='apphub_AppName')}, {clean_html}))

        entries = []
        for data_prop in traverse_obj(webpage, (
            {find_elements(cls='highlight_player_item highlight_movie', html=True)},
            ..., {extract_attributes}, 'data-props', {json.loads}, {dict},
        )):
            formats = []
            if hls_manifest := traverse_obj(data_prop, ('hlsManifest', {url_or_none})):
                formats.extend(self._extract_m3u8_formats(
                    hls_manifest, app_id, 'mp4', m3u8_id='hls', fatal=False))
            for dash_manifest in traverse_obj(data_prop, ('dashManifests', ..., {url_or_none})):
                formats.extend(self._extract_mpd_formats(
                    dash_manifest, app_id, mpd_id='dash', fatal=False))

            movie_id = traverse_obj(data_prop, ('id', {trim_str(start='highlight_movie_')}))
            entries.append({
                'id': movie_id,
                'title': f'{app_name} video {movie_id}',
                'formats': formats,
                'series': app_name,
                'series_id': app_id,
                'thumbnail': traverse_obj(data_prop, ('screenshot', {url_or_none})),
            })

        return self.playlist_result(entries, app_id, app_name)


class SteamCommunityIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?steamcommunity\.com/sharedfiles/filedetails/?(?:\?(?:[^#]+&)?id=)?(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://steamcommunity.com/sharedfiles/filedetails/2717708756',
        'info_dict': {
            'id': '39Sp2mB1Ly8',
            'ext': 'mp4',
            'title': 'Gmod Stamina System + Customisable HUD',
            'age_limit': 0,
            'availability': 'public',
            'categories': ['Gaming'],
            'channel': 'Zworld Gmod',
            'channel_follower_count': int,
            'channel_id': 'UCER1FWFSdMMiTKBnnEDBPaw',
            'channel_url': 'https://www.youtube.com/channel/UCER1FWFSdMMiTKBnnEDBPaw',
            'chapters': 'count:3',

Review comment (suggestion):
something I'm just noticing now... since `app_name` can potentially be `None` or empty:
```suggestion
                'title': join_nonempty(app_name, 'video', movie_id, delim=' ')',
```

Code after:
    def _real_extract(self, url):
        app_id = self._match_id(url)

        self._set_cookie('store.steampowered.com', 'wants_mature_content', '1')
        self._set_cookie('store.steampowered.com', 'birthtime', '946652401')
        self._set_cookie('store.steampowered.com', 'lastagecheckage', '1-January-2000')

        webpage = self._download_webpage(url, app_id)
        app_name = traverse_obj(webpage, ({find_element(cls='apphub_AppName')}, {clean_html}))

        entries = []
        for data_prop in traverse_obj(webpage, (
            {find_elements(cls='highlight_player_item highlight_movie', html=True)},
            ..., {extract_attributes}, 'data-props', {json.loads}, {dict},
        )):
            formats = []
            if hls_manifest := traverse_obj(data_prop, ('hlsManifest', {url_or_none})):
                formats.extend(self._extract_m3u8_formats(
                    hls_manifest, app_id, 'mp4', m3u8_id='hls', fatal=False))
            for dash_manifest in traverse_obj(data_prop, ('dashManifests', ..., {url_or_none})):
                formats.extend(self._extract_mpd_formats(
                    dash_manifest, app_id, mpd_id='dash', fatal=False))

            movie_id = traverse_obj(data_prop, ('id', {trim_str(start='highlight_movie_')}))
            entries.append({
                'id': movie_id,
                'title': join_nonempty(app_name, 'video', movie_id, delim=' '),
                'formats': formats,
                'series': app_name,
                'series_id': app_id,
                'thumbnail': traverse_obj(data_prop, ('screenshot', {url_or_none})),
            })

        return self.playlist_result(entries, app_id, app_name)


class SteamCommunityIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?steamcommunity\.com/sharedfiles/filedetails(?:/?\?(?:[^#]+&)?id=|/)(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://steamcommunity.com/sharedfiles/filedetails/2717708756',
        'info_dict': {
            'id': '39Sp2mB1Ly8',
            'ext': 'mp4',
            'title': 'Gmod Stamina System + Customisable HUD',
            'age_limit': 0,
            'availability': 'public',
            'categories': ['Gaming'],
            'channel': 'Zworld Gmod',
            'channel_follower_count': int,
            'channel_id': 'UCER1FWFSdMMiTKBnnEDBPaw',
            'channel_url': 'https://www.youtube.com/channel/UCER1FWFSdMMiTKBnnEDBPaw',