]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/filmmodu.py
[cleanup] Misc (#8338)
[yt-dlp.git] / yt_dlp / extractor / filmmodu.py
CommitLineData
be44eefd 1from .common import InfoExtractor
2from ..utils import int_or_none
3
4
5class FilmmoduIE(InfoExtractor):
b634ba74 6 _VALID_URL = r'https?://(?:www\.)?filmmodu\.org/(?P<id>[^/]+-(?:turkce-dublaj-izle|altyazili-izle))'
be44eefd 7 _TESTS = [{
8 'url': 'https://www.filmmodu.org/f9-altyazili-izle',
9 'md5': 'aeefd955c2a508a5bdaa3bcec8eeb0d4',
10 'info_dict': {
11 'id': '10804',
12 'ext': 'mp4',
13 'title': 'F9',
14 'description': 'md5:2713f584a4d65afa2611e2948d0b953c',
15 'subtitles': {
16 'tr': [{
17 'ext': 'vtt',
18 }],
19 },
20 'thumbnail': r're:https://s[0-9]+.filmmodu.org/uploads/movie/cover/10804/xXHZeb1yhJvnSHPzZDqee0zfMb6.jpg',
21 },
22 }, {
23 'url': 'https://www.filmmodu.org/the-godfather-turkce-dublaj-izle',
24 'md5': '109f2fcb9c941330eed133971c035c00',
25 'info_dict': {
26 'id': '3646',
27 'ext': 'mp4',
28 'title': 'Baba',
29 'description': 'md5:d43fd651937cd75cc650883ebd8d8461',
30 'thumbnail': r're:https://s[0-9]+.filmmodu.org/uploads/movie/cover/3646/6xKCYgH16UuwEGAyroLU6p8HLIn.jpg',
31 },
32 }]
33
34 def _real_extract(self, url):
35 video_id = self._match_id(url)
36 webpage = self._download_webpage(url, video_id)
37 title = self._og_search_title(webpage, fatal=True)
38 description = self._og_search_description(webpage)
39 thumbnail = self._og_search_thumbnail(webpage)
40 real_video_id = self._search_regex(r'var\s*videoId\s*=\s*\'([0-9]+)\'', webpage, 'video_id')
41 video_type = self._search_regex(r'var\s*videoType\s*=\s*\'([a-z]+)\'', webpage, 'video_type')
42 data = self._download_json('https://www.filmmodu.org/get-source', real_video_id, query={
43 'movie_id': real_video_id,
44 'type': video_type,
45 })
46 formats = [{
47 'url': source['src'],
48 'ext': 'mp4',
49 'format_id': source['label'],
50 'height': int_or_none(source.get('res')),
51 'protocol': 'm3u8_native',
52 } for source in data['sources']]
53
be44eefd 54 subtitles = {}
55
56 if data.get('subtitle'):
57 subtitles['tr'] = [{
58 'url': data['subtitle'],
59 }]
60
61 return {
62 'id': real_video_id,
63 'display_id': video_id,
64 'title': title,
65 'description': description,
66 'formats': formats,
67 'subtitles': subtitles,
68 'thumbnail': thumbnail,
69 }