mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-23 04:30:10 +09:00
Compare commits
1 Commits
81d6ddcbd5
...
124196e047
Author | SHA1 | Date | |
---|---|---|---|
|
124196e047 |
@ -1,9 +1,9 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from random import choice as random_choice
|
import random
|
||||||
from string import ascii_letters, digits
|
import string
|
||||||
from time import time as time_time
|
import time
|
||||||
|
|
||||||
from ..compat import compat_filter as filter
|
from ..compat import compat_filter as filter
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
@ -21,20 +21,40 @@ from .common import InfoExtractor
|
|||||||
|
|
||||||
|
|
||||||
class DoodStreamIE(InfoExtractor):
|
class DoodStreamIE(InfoExtractor):
|
||||||
# dood.* redirects
|
_VALID_URL = r'https?://(?:www\.)?dood\.(?:to|watch|so|la|pm|sh|ws|one)/[ed]/(?P<id>[a-z0-9]+)'
|
||||||
# .watch -> .re (but HEAD request fails in GenericIE)
|
|
||||||
# .so -> .li
|
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?P<host>dood\.(?:to|la|li|pm|re|sh|watch|ws|one)|ds2play\.com)/[ed]/(?P<id>[a-z\d]+)'
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://dood.li/e/h7ecgw5oqn8k',
|
'url': 'http://dood.to/e/5s1wmbdacezb',
|
||||||
'md5': '90f2af170551c17fc78bee7426890054',
|
'md5': '4568b83b31e13242b3f1ff96c55f0595',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'h7ecgw5oqn8k',
|
'id': '5s1wmbdacezb',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Free-Slow-Music',
|
'title': 'Kat Wonders - Monthly May 2020',
|
||||||
'upload_date': '20230814',
|
'description': 'Kat Wonders - Monthly May 2020 | DoodStream.com',
|
||||||
'thumbnail': 'https://img.doodcdn.co/splash/7mbnwydhb6kb7xyk.jpg',
|
'thumbnail': 'https://img.doodcdn.com/snaps/flyus84qgl2fsk4g.jpg',
|
||||||
},
|
},
|
||||||
|
'skip': 'Video not found',
|
||||||
|
}, {
|
||||||
|
'url': 'http://dood.watch/d/5s1wmbdacezb',
|
||||||
|
'md5': '4568b83b31e13242b3f1ff96c55f0595',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '5s1wmbdacezb',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Kat Wonders - Monthly May 2020',
|
||||||
|
'description': 'Kat Wonders - Monthly May 2020 | DoodStream.com',
|
||||||
|
'thumbnail': 'https://img.doodcdn.com/snaps/flyus84qgl2fsk4g.jpg',
|
||||||
|
},
|
||||||
|
'skip': 'Video not found',
|
||||||
|
}, {
|
||||||
|
'url': 'https://dood.to/d/jzrxn12t2s7n',
|
||||||
|
'md5': '3207e199426eca7c2aa23c2872e6728a',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'jzrxn12t2s7n',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Stacy Cruz Cute ALLWAYSWELL',
|
||||||
|
'description': 'Stacy Cruz Cute ALLWAYSWELL | DoodStream.com',
|
||||||
|
'thumbnail': 'https://img.doodcdn.com/snaps/8edqd5nppkac3x8u.jpg',
|
||||||
|
},
|
||||||
|
'skip': 'Video not found',
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://dood.to/d/is34uy8wvaet',
|
'url': 'https://dood.to/d/is34uy8wvaet',
|
||||||
'md5': '04740d3ba93bcd638aa7a097d9226710',
|
'md5': '04740d3ba93bcd638aa7a097d9226710',
|
||||||
@ -46,10 +66,9 @@ class DoodStreamIE(InfoExtractor):
|
|||||||
'thumbnail': r're:https?://img\.doodcdn\.com?/[\w/]+\.jpg',
|
'thumbnail': r're:https?://img\.doodcdn\.com?/[\w/]+\.jpg',
|
||||||
'filesize_approx': int,
|
'filesize_approx': int,
|
||||||
'duration': 9886,
|
'duration': 9886,
|
||||||
},
|
}
|
||||||
'skip': 'Video not found',
|
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://dood.sh/d/wlihoael8uog',
|
'url': 'https://dood.so/d/wlihoael8uog',
|
||||||
'md5': '2c14444c89788cc309738c1560abe278',
|
'md5': '2c14444c89788cc309738c1560abe278',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'wlihoael8uog',
|
'id': 'wlihoael8uog',
|
||||||
@ -59,56 +78,43 @@ class DoodStreamIE(InfoExtractor):
|
|||||||
'upload_date': '20220319',
|
'upload_date': '20220319',
|
||||||
'filesize_approx': int,
|
'filesize_approx': int,
|
||||||
'duration': 12.0,
|
'duration': 12.0,
|
||||||
},
|
}
|
||||||
}, {
|
|
||||||
'url': 'http://dood.ws/d/h7ecgw5oqn8k',
|
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
|
||||||
'url': 'https://dood.li/d/wlihoael8uog',
|
|
||||||
'only_matching': True,
|
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
host = 'dood.li'
|
url = 'https://dood.to/e/' + video_id
|
||||||
url = 'https://%s/e/%s' % (host, video_id)
|
headers = {
|
||||||
webpage = self._download_webpage(url, video_id, note='Downloading "/e/" webpage')
|
'User-Agent': 'Mozilla/5.0', # (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/66.0',
|
||||||
|
}
|
||||||
|
webpage = self._download_webpage(url, video_id, headers=headers)
|
||||||
|
|
||||||
def get_title(html, fatal=False):
|
def get_title(html, fatal=False):
|
||||||
return self._html_search_regex(r'<title\b[^>]*>([^<]+?)(?:[|-]\s+DoodStream\s*)?</title', html, 'title', fatal=fatal)
|
return self._html_search_regex(r'<title\b[^>]*>([^<]+?)(?:[|-]\s+DoodStream\s*)?</title', html, 'title', fatal=fatal)
|
||||||
|
|
||||||
title = get_title(webpage)
|
title = get_title(webpage)
|
||||||
if title == 'Video not found' or (
|
if title == 'Video not found':
|
||||||
title == '' and 'Not Found' == self._html_search_regex(r'<h1\b[^>]*>([^<]+?)</h1', webpage, 'heading1', default=None)):
|
|
||||||
raise ExtractorError(title, expected=True)
|
raise ExtractorError(title, expected=True)
|
||||||
|
token = self._html_search_regex(r'''[?&]token=([a-z0-9]+)[&']''', webpage, 'token')
|
||||||
|
|
||||||
pass_md5, token = self._search_regex(
|
headers.update({
|
||||||
r'["\']/(?P<pm>pass_md5/[\da-f-]+/(?P<tok>[\da-z]+))', webpage, 'tokens',
|
# 'User-Agent': 'Mozilla/5.0', # (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/66.0',
|
||||||
group=('pm', 'tok'))
|
'referer': url
|
||||||
headers = {
|
|
||||||
'Referer': url,
|
|
||||||
}
|
|
||||||
# construct the media link
|
|
||||||
final_url = self._download_webpage(
|
|
||||||
'https://%s/%s' % (host, pass_md5), video_id, headers={
|
|
||||||
'Referer': url,
|
|
||||||
}, note='Downloading authpage URL')
|
|
||||||
final_url += ''.join((random_choice(ascii_letters + digits)
|
|
||||||
for _ in range(10)))
|
|
||||||
final_url = update_url_query(final_url, {
|
|
||||||
'token': token,
|
|
||||||
'expiry': int(time_time() * 1000),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
# get additional metadata
|
pass_md5 = self._html_search_regex(r'(/pass_md5.*?)\'', webpage, 'pass_md5')
|
||||||
|
final_url = (
|
||||||
|
self._download_webpage('https://dood.to' + pass_md5, video_id, headers=headers, note='Downloading final URL')
|
||||||
|
+ ''.join((random.choice(string.ascii_letters + string.digits) for _ in range(10)))
|
||||||
|
)
|
||||||
|
final_url = update_url_query(final_url, {'token': token, 'expiry': int(time.time() * 1000), })
|
||||||
|
|
||||||
thumb = next(filter(None, (url_or_none(self._html_search_meta(x, webpage, default=None))
|
thumb = next(filter(None, (url_or_none(self._html_search_meta(x, webpage, default=None))
|
||||||
for x in ('og:image', 'twitter:image'))), None)
|
for x in ('og:image', 'twitter:image'))), None)
|
||||||
description = self._html_search_meta(
|
description = self._html_search_meta(
|
||||||
('og:description', 'description', 'twitter:description'), webpage, default=None)
|
('og:description', 'description', 'twitter:description'), webpage, default=None)
|
||||||
|
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage('https://dood.to/d/' + video_id, video_id, headers=headers, fatal=False) or ''
|
||||||
'https://%s/d/%s' % (host, video_id), video_id, fatal=False,
|
|
||||||
note='Downloading alternative "/d/" page') or ''
|
|
||||||
|
|
||||||
title = (
|
title = (
|
||||||
self._html_search_meta(('og:title', 'twitter:title'), webpage, default=None)
|
self._html_search_meta(('og:title', 'twitter:title'), webpage, default=None)
|
||||||
|
Loading…
Reference in New Issue
Block a user