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

Code before:
            'thumbnail': r're:https://s[0-9]+.filmmodu.org/uploads/movie/cover/3646/6xKCYgH16UuwEGAyroLU6p8HLIn.jpg',
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)
        title = self._og_search_title(webpage, fatal=True)
        description = self._og_search_description(webpage)
        thumbnail = self._og_search_thumbnail(webpage)
        real_video_id = self._search_regex(r'var\s*videoId\s*=\s*\'([0-9]+)\'', webpage, 'video_id')
        video_type = self._search_regex(r'var\s*videoType\s*=\s*\'([a-z]+)\'', webpage, 'video_type')
        data = self._download_json('https://www.filmmodu.org/get-source', real_video_id, query={
            'movie_id': real_video_id,
            'type': video_type,
        })
        formats = [
            {
                'url': source['src'],
                'format_id': source['label'],
                'resolution': '{}p'.format(source['res']),
                'width': int_or_none(source['res']),
            }
            for source in data['sources']
        ]

        self._sort_formats(formats)

        subtitles = {}

        if data.get('subtitle'):
            subtitles['tr'] = [{
                'url': data['subtitle'],
            }]

        return {
            'id': real_video_id,
            'title': title,
            'description': description,
            'formats': formats,
            'subtitles': subtitles,
            'thumbnail': thumbnail,
        }


Review comment (suggestion):
```suggestion
        formats = [{
            'url': source['src'],
            'format_id': source.get('label'),
            'width': int_or_none(source.get('res')),
        } for source in data['sources']]

```

Code after:
            'thumbnail': r're:https://s[0-9]+.filmmodu.org/uploads/movie/cover/3646/6xKCYgH16UuwEGAyroLU6p8HLIn.jpg',
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)
        title = self._og_search_title(webpage, fatal=True)
        description = self._og_search_description(webpage)
        thumbnail = self._og_search_thumbnail(webpage)
        real_video_id = self._search_regex(r'var\s*videoId\s*=\s*\'([0-9]+)\'', webpage, 'video_id')
        video_type = self._search_regex(r'var\s*videoType\s*=\s*\'([a-z]+)\'', webpage, 'video_type')
        data = self._download_json('https://www.filmmodu.org/get-source', real_video_id, query={
            'movie_id': real_video_id,
            'type': video_type,
        })
        formats = [{
            'url': source['src'],
            'ext': 'mp4',
            'format_id': source['label'],
            'height': int_or_none(source.get('res')),
            'protocol': 'm3u8_native',
        } for source in data['sources']]

        self._sort_formats(formats)

        subtitles = {}

        if data.get('subtitle'):
            subtitles['tr'] = [{
                'url': data['subtitle'],
            }]

        return {
            'id': real_video_id,
            'display_id': video_id,
            'title': title,
            'description': description,
            'formats': formats,
            'subtitles': subtitles,
            'thumbnail': thumbnail,
        }