]>
Commit | Line | Data |
---|---|---|
be44eefd | 1 | from .common import InfoExtractor |
2 | from ..utils import int_or_none | |
3 | ||
4 | ||
5 | class FilmmoduIE(InfoExtractor): | |
6 | _VALID_URL = r'https?://(?:www.)?filmmodu.org/(?P<id>[^/]+-(?:turkce-dublaj-izle|altyazili-izle))' | |
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 | ||
54 | self._sort_formats(formats) | |
55 | ||
56 | subtitles = {} | |
57 | ||
58 | if data.get('subtitle'): | |
59 | subtitles['tr'] = [{ | |
60 | 'url': data['subtitle'], | |
61 | }] | |
62 | ||
63 | return { | |
64 | 'id': real_video_id, | |
65 | 'display_id': video_id, | |
66 | 'title': title, | |
67 | 'description': description, | |
68 | 'formats': formats, | |
69 | 'subtitles': subtitles, | |
70 | 'thumbnail': thumbnail, | |
71 | } |