]> jfr.im git - yt-dlp.git/commitdiff
[noodlemagazine] Add extractor (#2293)
authortrasssh <redacted>
Mon, 10 Jan 2022 17:13:09 +0000 (01:13 +0800)
committerGitHub <redacted>
Mon, 10 Jan 2022 17:13:09 +0000 (22:43 +0530)
Authored by: trassshhub

yt_dlp/extractor/extractors.py
yt_dlp/extractor/noodlemagazine.py [new file with mode: 0644]

index cc31c747458cbd11166924b1ab182bca44e435a3..da67c7cd934e316e1a013dbc182a7e80256b1dba 100644 (file)
 from .njpwworld import NJPWWorldIE
 from .nobelprize import NobelPrizeIE
 from .nonktube import NonkTubeIE
+from .noodlemagazine import NoodleMagazineIE
 from .noovo import NoovoIE
 from .normalboots import NormalbootsIE
 from .nosvideo import NosVideoIE
diff --git a/yt_dlp/extractor/noodlemagazine.py b/yt_dlp/extractor/noodlemagazine.py
new file mode 100644 (file)
index 0000000..2f170bb
--- /dev/null
@@ -0,0 +1,67 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+    parse_duration,
+    parse_count,
+    unified_strdate
+)
+
+
+class NoodleMagazineIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]+)'
+    _TEST = {
+        'url': 'https://adult.noodlemagazine.com/watch/-67421364_456239604',
+        'md5': '9e02aa763612929d0b4b850591a9248b',
+        'info_dict': {
+            'id': '-67421364_456239604',
+            'title': 'Aria alexander manojob',
+            'thumbnail': r're:^https://.*\.jpg',
+            'ext': 'mp4',
+            'duration': 903,
+            'view_count': int,
+            'like_count': int,
+            'description': 'Aria alexander manojob',
+            'tags': ['aria', 'alexander', 'manojob'],
+            'upload_date': '20190218',
+            'age_limit': 18
+        }
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+        title = self._og_search_title(webpage)
+        duration = parse_duration(self._html_search_meta('video:duration', webpage, 'duration', default=None))
+        description = self._og_search_property('description', webpage, default='').replace(' watch online hight quality video', '')
+        tags = self._html_search_meta('video:tag', webpage, default='').split(', ')
+        view_count = parse_count(self._html_search_meta('ya:ovs:views_total', webpage, default=None))
+        like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None))
+        upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default=''))
+
+        key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'key')
+        playlist_info = self._download_json(f'https://adult.noodlemagazine.com/playlist/{video_id}?m={key}', video_id)
+        thumbnail = self._og_search_property('image', webpage, default=None) or playlist_info.get('image')
+
+        formats = [{
+            'url': source.get('file'),
+            'quality': source.get('label'),
+            'ext': source.get('type'),
+        } for source in playlist_info.get('sources')]
+
+        self._sort_formats(formats)
+
+        return {
+            'id': video_id,
+            'formats': formats,
+            'title': title,
+            'thumbnail': thumbnail,
+            'duration': duration,
+            'description': description,
+            'tags': tags,
+            'view_count': view_count,
+            'like_count': like_count,
+            'upload_date': upload_date,
+            'age_limit': 18
+        }