From d42b7be94cb35f843982301c87beab79a53a03db Mon Sep 17 00:00:00 2001 From: Elliot Algase Date: Mon, 17 Jun 2019 03:06:17 -0400 Subject: [PATCH] [nimses] create extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/nimses.py | 55 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 youtube_dl/extractor/nimses.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 392b1f92b..85c6a5201 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -756,6 +756,7 @@ from .nick import ( NickNightIE, NickRuIE, ) +from .nimses import NimsesIE from .niconico import NiconicoIE, NiconicoPlaylistIE from .ninecninemedia import NineCNineMediaIE from .ninegag import NineGagIE diff --git a/youtube_dl/extractor/nimses.py b/youtube_dl/extractor/nimses.py new file mode 100644 index 000000000..67fafaa5b --- /dev/null +++ b/youtube_dl/extractor/nimses.py @@ -0,0 +1,55 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class NimsesIE(InfoExtractor): + _UUID_RE = r'[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}' + _VALID_URL = r'https?://web\.nimses\.com/post/(?P%s)' % _UUID_RE + _TEST = { + 'url': 'https://web.nimses.com/post/f4227748-e7ab-4b4d-906e-834234b3d921', + 'md5': '3316c2c4377d73cedf7b9c844fcc3144', + 'info_dict': { + 'id': 'f4227748-e7ab-4b4d-906e-834234b3d921', + 'ext': 'mp4', + 'title': 'Video by pewdiepie', + 'thumbnail': r're:^https?://.*\.jpg$', + 'description': 'Welcome', + 'uploader': 'pewdiepie', + 'uploader_id': '5384bee1-ab81-4370-b996-fc62b1e561aa', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + api_info = self._download_json('https://web.nimses.com/api/feed/post?id=' + video_id, video_id) + uploader_id = api_info.get('profileId') + uploader = api_info.get('userName') + video_url = api_info['photo'] + description = api_info.get('text') + likes = api_info.get('nimsCount') + comments = api_info.get('commentsCount') + views = api_info.get('viewsCount') + title = api_info['title'] # note: can be empty + if title == '': + title = 'Video by ' + uploader + thumbnail = api_info.get('urlThumbnail') + + return { + 'id': video_id, + 'title': title, + 'description': description, + 'uploader_id': uploader_id, + 'channel_id': uploader_id, + 'uploader': uploader, + 'channel': uploader, + 'creator': uploader, + 'url': video_url, + 'description': description, + 'like_count': likes, + 'comment_count': comments, + 'view_count': views, + 'title': title, + 'thumbnail': thumbnail, + }