From 2b488a91791dbc80ac54b3e8423b8f37e21c9412 Mon Sep 17 00:00:00 2001 From: sxvghd Date: Fri, 29 Jan 2021 19:01:36 +0100 Subject: [PATCH] [doodstream] add new extractor --- youtube_dl/extractor/doodstream.py | 67 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/generic.py | 6 +++ 3 files changed, 74 insertions(+) create mode 100644 youtube_dl/extractor/doodstream.py diff --git a/youtube_dl/extractor/doodstream.py b/youtube_dl/extractor/doodstream.py new file mode 100644 index 000000000..03bc58e56 --- /dev/null +++ b/youtube_dl/extractor/doodstream.py @@ -0,0 +1,67 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import string +import random +import time +import re + +from .common import InfoExtractor + + +class DoodStreamIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?dood\.(?:to|watch|so)/[ed]/(?P[a-z0-9]+)' + _TESTS = [{ + 'url': 'https://dood.to/d/wpyp2mgwi2kb', + 'md5': '2aaf633bcd5fefb64b27344f55022bf9', + 'info_dict': { + 'id': 'wpyp2mgwi2kb', + 'ext': 'mp4', + 'title': 'Big Buck Bunny Trailer', + 'thumbnail': r're:^https?://.*\.jpg$', + }, + }] + + @staticmethod + def _extract_urls(webpage): + return re.findall( + r']+?src=["\'](?P(?:https?://)?dood\.(?:watch|to|so)/e/.+?)["\']', + webpage) + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + if '/d/' in url: + url = "https://dood.to" + self._html_search_regex( + r'