From 31d32207c02fbb7c0278f206adcf5eee9ff4df43 Mon Sep 17 00:00:00 2001 From: mp3butcher Date: Sat, 23 Nov 2024 18:23:41 +0100 Subject: [PATCH] add doostream extractor --- youtube_dl/extractor/doodstream.py | 100 +++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 101 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 00000000000..a941cd3646a --- /dev/null +++ b/youtube_dl/extractor/doodstream.py @@ -0,0 +1,100 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import random +import string +import time +import re + +from ..utils import ( + clean_html, + get_element_by_class, + parse_duration, + parse_filesize, + unified_strdate, +) + +from .common import InfoExtractor + + +class DoodStreamIE(InfoExtractor): + _VALID_URL = r'https?://(?P(?:www\.)?(dood|ds2play)\.(?:[^/]*))/[ed]/(?P[a-z0-9]+)' + _TESTS = [{ + 'url': 'https://dood.li/e/h7ecgw5oqn8k', + 'md5': '4568b83b31e13242b3f1ff96c55f0595', + 'info_dict': { + 'id': 'h7ecgw5oqn8k', + 'ext': 'mp4', + 'title': 'Free-Slow-Music - DoodStream', + 'thumbnail': 'https://img.doodcdn.co/splash/7mbnwydhb6kb7xyk.jpg', + }, + 'skip': 'Video not found', + }, { + 'url': 'http://dood.watch/d/h7ecgw5oqn8k', + 'md5': '4568b83b31e13242b3f1ff96c55f0595', + 'info_dict': { + 'id': 'h7ecgw5oqn8k', + 'ext': 'mp4', + 'title': 'Free-Slow-Music - DoodStream', + 'thumbnail': 'https://img.doodcdn.co/splash/7mbnwydhb6kb7xyk.jpg', + }, + 'skip': 'Video not found', + }, { + 'url': 'https://dood.li/d/wlihoael8uog', + 'md5': '2c14444c89788cc309738c1560abe278', + 'info_dict': { + 'id': 'wlihoael8uog', + 'ext': 'mp4', + 'title': 'VID 20220319 161659 - DoodStream', + 'thumbnail': r're:https?://img\.doodcdn\.com?/splash/rmpnhb8ckkk79cge\.jpg', + }, + 'skip': 'Video not found', + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + host = re.match(self._VALID_URL, url).groups()[0] + url = url.replace(host, 'dood.li') + host = 'dood.li' + webpage = self._download_webpage(url, video_id) + + if '/d/' in url: + url = ('https://%s' % host) + self._html_search_regex( + r'