From f2c109e5d65a633ebedf4966dcdc761faab1bdc5 Mon Sep 17 00:00:00 2001 From: mp3butcher Date: Tue, 26 Nov 2024 20:26:13 +0100 Subject: [PATCH] dirk suggestions compliance --- youtube_dl/extractor/doodstream.py | 56 +++++++++++++----------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/youtube_dl/extractor/doodstream.py b/youtube_dl/extractor/doodstream.py index 013699405..6f3e49fc5 100644 --- a/youtube_dl/extractor/doodstream.py +++ b/youtube_dl/extractor/doodstream.py @@ -4,7 +4,6 @@ from __future__ import unicode_literals import random import string import time -import re from ..utils import ( clean_html, @@ -14,71 +13,64 @@ from ..utils import ( unified_strdate, ) -from .common import InfoExtractor +from .common import ( + InfoExtractor, + update_url_query, +) class DoodStreamIE(InfoExtractor): - _VALID_URL = r'https?://(?P(?:www\.)?(dood|ds2play)\.(?:[^/]*))/[ed]/(?P[a-z0-9]+)' + _VALID_URL = r'https?://(?:www\.)?(?:dood\.(?:to|la|li|pm|re|sh|ws|one|watch)|ds2play\.com)/[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', + 'title': 'Free-Slow-Music', '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', - } + 'only_matching': True, }, { 'url': 'https://dood.li/d/wlihoael8uog', 'md5': '2c14444c89788cc309738c1560abe278', 'info_dict': { 'id': 'wlihoael8uog', 'ext': 'mp4', - 'title': 'VID 20220319 161659 - DoodStream', + 'title': 'VID 20220319 161659', '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' + url = 'https://%s/e/%s' % (host, video_id) webpage = self._download_webpage(url, video_id) - if '/d/' in url: - url = ('https://%s' % host) + self._html_search_regex( - r'