mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-23 12:40:11 +09:00
Compare commits
1 Commits
cc238fb5cd
...
5f3a2055bb
Author | SHA1 | Date | |
---|---|---|---|
|
5f3a2055bb |
@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
|
import re
|
||||||
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
clean_html,
|
clean_html,
|
||||||
@ -13,64 +14,71 @@ from ..utils import (
|
|||||||
unified_strdate,
|
unified_strdate,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .common import (
|
from .common import InfoExtractor
|
||||||
InfoExtractor,
|
|
||||||
update_url_query,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DoodStreamIE(InfoExtractor):
|
class DoodStreamIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?:dood\.(?:to|la|li|pm|re|sh|ws|one|watch)|ds2play\.com)/[ed]/(?P<id>[a-z0-9]+)'
|
_VALID_URL = r'https?://(?P<host>(?:www\.)?(dood|ds2play)\.(?:[^/]*))/[ed]/(?P<id>[a-z0-9]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://dood.li/e/h7ecgw5oqn8k',
|
'url': 'https://dood.li/e/h7ecgw5oqn8k',
|
||||||
'md5': '90f2af170551c17fc78bee7426890054',
|
'md5': '90f2af170551c17fc78bee7426890054',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'h7ecgw5oqn8k',
|
'id': 'h7ecgw5oqn8k',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Free-Slow-Music',
|
'title': 'Free-Slow-Music - DoodStream',
|
||||||
'thumbnail': 'https://img.doodcdn.co/splash/7mbnwydhb6kb7xyk.jpg',
|
'thumbnail': 'https://img.doodcdn.co/splash/7mbnwydhb6kb7xyk.jpg',
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://dood.watch/d/h7ecgw5oqn8k',
|
'url': 'http://dood.watch/d/h7ecgw5oqn8k',
|
||||||
'only_matching': True,
|
'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',
|
'url': 'https://dood.li/d/wlihoael8uog',
|
||||||
'md5': '2c14444c89788cc309738c1560abe278',
|
'md5': '2c14444c89788cc309738c1560abe278',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'wlihoael8uog',
|
'id': 'wlihoael8uog',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'VID 20220319 161659',
|
'title': 'VID 20220319 161659 - DoodStream',
|
||||||
'thumbnail': 'https://img.doodcdn.co/splash/rmpnhb8ckkk79cge.jpg',
|
'thumbnail': 'https://img.doodcdn.co/splash/rmpnhb8ckkk79cge.jpg',
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(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'
|
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'<iframe src="(/e/[a-z0-9]+)"', webpage, 'embed')
|
||||||
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
title = self._html_search_meta(['og:title', 'twitter:title'],
|
title = self._html_search_meta(['og:title', 'twitter:title'],
|
||||||
webpage, default=None) or self._html_search_regex(r'<title\b[^>]*>([^<]+?)(?:[|-]\s+DoodStream\s*)?</title', webpage, 'title', fatal=False)
|
webpage, default=None) or self._html_search_regex(
|
||||||
|
r'<title\b[^>]*>([^<]+)</title>', webpage, 'title', default=None)
|
||||||
thumb = self._html_search_meta(['og:image', 'twitter:image', 'poster'],
|
thumb = self._html_search_meta(['og:image', 'twitter:image', 'poster'],
|
||||||
webpage, default=None)
|
webpage, default=None)
|
||||||
pass_md5, token = self._search_regex(
|
token = self._html_search_regex(r'[?&]token=([a-z0-9]+)[&\']', webpage, 'token')
|
||||||
r'["\']/(?P<pm>pass_md5/[\da-f-]+/(?P<tok>[\da-z]+))', webpage, 'tokens',
|
|
||||||
group=('pm', 'tok'))
|
|
||||||
|
|
||||||
auth_url = ('https://%s/' % host) + pass_md5
|
|
||||||
headers = {'Referer': url}
|
|
||||||
authpage = self._download_webpage(auth_url, video_id, headers=headers)
|
|
||||||
final_url = update_url_query(
|
|
||||||
authpage + ''.join((random.choice(string.ascii_letters + string.digits) for _ in range(10))),
|
|
||||||
{
|
|
||||||
'token': token,
|
|
||||||
'expiry': int(time.time() * 1000),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
description = self._html_search_meta(
|
description = self._html_search_meta(
|
||||||
['og:description', 'description', 'twitter:description'],
|
['og:description', 'description', 'twitter:description'],
|
||||||
webpage, default=None)
|
webpage, default=None)
|
||||||
|
auth_url = ('https://%s/' % host) + self._html_search_regex(
|
||||||
|
r'(/pass_md5.*?)\'', webpage, 'pass_md5')
|
||||||
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/66.0',
|
||||||
|
'Referer': url
|
||||||
|
}
|
||||||
|
authpage = self._download_webpage(auth_url, video_id, headers=headers)
|
||||||
|
final_url = authpage + ''.join([random.choice(string.ascii_letters + string.digits) for _ in
|
||||||
|
range(10)]) + "?token=" + token + "&expiry=" + str(int(time.time() * 1000))
|
||||||
|
|
||||||
def get_class_text(x):
|
def get_class_text(x):
|
||||||
return clean_html(get_element_by_class(x, webpage))
|
return clean_html(get_element_by_class(x, webpage))
|
||||||
|
Loading…
Reference in New Issue
Block a user