# 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'