From 5adc36f2aed75566576fb644ef84ca206d0d0ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=96=88?= Date: Wed, 27 Jan 2021 12:12:39 -0500 Subject: [PATCH] [ninjastream] Adding new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/ninjastream.py | 69 +++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 youtube_dl/extractor/ninjastream.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index ab8d6a5a5..7b360c00c 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -777,6 +777,7 @@ from .niconico import NiconicoIE, NiconicoPlaylistIE from .ninecninemedia import NineCNineMediaIE from .ninegag import NineGagIE from .ninenow import NineNowIE +from .ninjastream import NinjaStreamIE from .nintendo import NintendoIE from .njpwworld import NJPWWorldIE from .nobelprize import NobelPrizeIE diff --git a/youtube_dl/extractor/ninjastream.py b/youtube_dl/extractor/ninjastream.py new file mode 100644 index 000000000..ef172f73a --- /dev/null +++ b/youtube_dl/extractor/ninjastream.py @@ -0,0 +1,69 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import os + +from .common import InfoExtractor +from ..utils import ExtractorError + + +class NinjaStreamIE(InfoExtractor): + """ + Handles downloading video from ninjastream.to + """ + _VALID_URL = r'https?://(?:\w+\.)?ninjastream\.to/watch/[0-9a-zA-Z]+' + _TESTS = [ + { + 'url': 'https://ninjastream.to/watch/74GA02Nw6ZYBk', + 'info_dict': { + 'id': '74GA02Nw6ZYBk', + 'ext': 'mp4', + 'title': 'Damon_Andros_and_Stephen_Harte' + }, + } + ] + + def _real_extract(self, url): + """ + Parses the URL into the video's URL. + """ + # Parse the video id + video_id = self._search_regex(r'https?://(?:\w+\.)?ninjastream\.to/watch/([0-9a-zA-Z]+)', + url, 'video_id', fatal=False) or '' + + # Get the hosted webpage + webpage = self._download_webpage(url, video_id) + + # The links to the m3u8 file will be buried and html encoded in the tag + jwplayer_link = self._html_search_regex(r'