Repository: yt-dlp/yt-dlp

Issue:
Add support for filmmodu.org
<!--

######################################################################
  WARNING!
  IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE
######################################################################

-->


## Checklist

<!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of yt-dlp:
- First of, make sure you are using the latest version of yt-dlp. Run `yt-dlp --version` and ensure your version is 2021.04.22. If it's not, see https://github.com/yt-dlp/yt-dlp on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that site you are requesting is not dedicated to copyright infringement, see https://github.com/yt-dlp/yt-dlp. yt-dlp does not support such sites. In order for site support request to be accepted all provided example URLs should not violate any copyrights.
- Search the bugtracker for similar site support requests: https://github.com/yt-dlp/yt-dlp. DO NOT post duplicates.
- Finally, put x into all relevant boxes like this [x] (Dont forget to delete the empty space)
-->

- [x] I'm reporting a new site support request
- [x] I've verified that I'm running yt-dlp version **2021.04.22**
- [x] I've checked that all provided URLs are alive and playable in a browser
- [ ] I've checked that none of provided URLs violate any copyrights
- [x] I've searched the bugtracker for similar site support requests including closed ones


## Example URLs

<!--
Provide all kinds of example URLs support for which should be included. Replace following example URLs by yours.
-->

- https://www.filmmodu.org/avengers-endgame-hd-turkce-dublaj-izle
- https://www.filmmodu.org/avengers-endgame-hd-altyazili-izle


## Description

<!--
Provide any additional information.
If work on your issue requires account credentials please provide them or explain how one can obtain them.
-->

- Sample page URL https://www.filmmodu.org/traffic-turkce-dublaj-izle
- Extract movie_id form page source e.g. var videoId = '1585'
- Extract videoType form page source e.g. var videoType = 'tr'
- Create m3u8 url like https://www.filmmodu.org/get-source?movie_id=videoId&type=videoType
- final URL should like https://www.filmmodu.org/get-source?movie_id=1585&type=tr



Discussion:
Cant access the site. Which country is it available in?
www is required I think. Please try with www like https://www.filmmodu.org I can access it from TURKIYE
Related: https://github.com/ytdl-org/youtube-dl/issues/28924

Resolving patch:
diff --git a/yt_dlp/extractor/extractors.py b/yt_dlp/extractor/extractors.py
--- a/yt_dlp/extractor/extractors.py
+++ b/yt_dlp/extractor/extractors.py
@@ -420,6 +420,7 @@
     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
--- /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<id>[^/]+-(?: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,
+        }


Test patch: