From be44eefd5e30825cabc31771beae478f0953327d Mon Sep 17 00:00:00 2001 From: mzbaulhaque <11481344+mzbaulhaque@users.noreply.github.com> Date: Sun, 15 Aug 2021 01:10:56 +0600 Subject: [PATCH] [filmmodu] Add extractor (#690) Closes #288 Authored by: mzbaulhaque --- yt_dlp/extractor/extractors.py | 1 + yt_dlp/extractor/filmmodu.py | 74 ++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 yt_dlp/extractor/filmmodu.py diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py index 5b15bb8e7..a36622f13 100644 --- a/yt_dlp/extractor/extractors.py +++ b/yt_dlp/extractor/extractors.py @@ -420,6 +420,7 @@ from .fc2 import ( FC2EmbedIE, ) from .fczenit import FczenitIE +from .filmmodu import FilmmoduIE from .filmon import ( FilmOnIE, FilmOnChannelIE, diff --git a/yt_dlp/extractor/filmmodu.py b/yt_dlp/extractor/filmmodu.py new file mode 100644 index 000000000..2746876d5 --- /dev/null +++ b/yt_dlp/extractor/filmmodu.py @@ -0,0 +1,74 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import int_or_none + + +class FilmmoduIE(InfoExtractor): + _VALID_URL = r'https?://(?:www.)?filmmodu.org/(?P[^/]+-(?:turkce-dublaj-izle|altyazili-izle))' + _TESTS = [{ + 'url': 'https://www.filmmodu.org/f9-altyazili-izle', + 'md5': 'aeefd955c2a508a5bdaa3bcec8eeb0d4', + 'info_dict': { + 'id': '10804', + 'ext': 'mp4', + 'title': 'F9', + 'description': 'md5:2713f584a4d65afa2611e2948d0b953c', + 'subtitles': { + 'tr': [{ + 'ext': 'vtt', + }], + }, + 'thumbnail': r're:https://s[0-9]+.filmmodu.org/uploads/movie/cover/10804/xXHZeb1yhJvnSHPzZDqee0zfMb6.jpg', + }, + }, { + 'url': 'https://www.filmmodu.org/the-godfather-turkce-dublaj-izle', + 'md5': '109f2fcb9c941330eed133971c035c00', + 'info_dict': { + 'id': '3646', + 'ext': 'mp4', + 'title': 'Baba', + 'description': 'md5:d43fd651937cd75cc650883ebd8d8461', + '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, + }