From c09207ac921ee7b6a4acf0c164ad8359656311eb Mon Sep 17 00:00:00 2001 From: mp3butcher Date: Sat, 23 Nov 2024 18:23:41 +0100 Subject: [PATCH 1/2] add doostream extractor --- youtube_dl/extractor/doodstream.py | 97 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 98 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..013699405 --- /dev/null +++ b/youtube_dl/extractor/doodstream.py @@ -0,0 +1,97 @@ +# 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': '90f2af170551c17fc78bee7426890054', + 'info_dict': { + 'id': 'h7ecgw5oqn8k', + 'ext': 'mp4', + 'title': 'Free-Slow-Music - DoodStream', + 'thumbnail': 'https://img.doodcdn.co/splash/7mbnwydhb6kb7xyk.jpg', + } + }, { + 'url': 'http://dood.watch/d/h7ecgw5oqn8k', + 'md5': '90f2af170551c17fc78bee7426890054', + 'info_dict': { + 'id': 'h7ecgw5oqn8k', + 'ext': 'mp4', + 'title': 'Free-Slow-Music - DoodStream', + 'thumbnail': 'https://img.doodcdn.co/splash/7mbnwydhb6kb7xyk.jpg', + } + }, { + 'url': 'https://dood.li/d/wlihoael8uog', + 'md5': '2c14444c89788cc309738c1560abe278', + 'info_dict': { + 'id': 'wlihoael8uog', + 'ext': 'mp4', + 'title': 'VID 20220319 161659 - DoodStream', + 'thumbnail': 'https://img.doodcdn.co/splash/rmpnhb8ckkk79cge.jpg', + } + }] + + 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'