Skip to content

Commit

Permalink
Further small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkf authored Nov 29, 2024
1 parent ab9ad56 commit 98e6231
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions youtube_dl/extractor/doodstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ def get_title(html, fatal=False):
return self._html_search_regex(r'<title\b[^>]*>([^<]+?)(?:[|-]\s+DoodStream\s*)?</title', html, 'title', fatal=fatal)

title = get_title(webpage)
if title == 'Video not found':
if title == 'Video not found' or (
title == '' and 'Not Found' == self._html_search_regex(r'<h1\b[^>]*>([^<]+?)</h1', webpage, 'heading1', default=None)):
raise ExtractorError(title, expected=True)
token = self._html_search_regex(r'''[?&]token=([a-z0-9]+)[&']''', webpage, 'token')

headers.update({
# 'User-Agent': 'Mozilla/5.0', # (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/66.0',
'referer': url
})

pass_md5 = self._html_search_regex(r'(/pass_md5.*?)\'', webpage, 'pass_md5')
pass_md5, token = self._search_regex(
r'["\']/(?P<pm>pass_md5/[\da-f-]+/(?P<tok>[\da-z]+))', webpage, 'tokens',
group=('pm', 'tok'))
headers = {
'Referer': url,
}
# construct the media link
final_url = self._download_webpage(
'https://%s/%s' % (host, pass_md5), video_id, headers={
Expand All @@ -100,6 +100,7 @@ def get_title(html, fatal=False):
'expiry': int(time_time() * 1000),
})

# get additional metadata
thumb = next(filter(None, (url_or_none(self._html_search_meta(x, webpage, default=None))
for x in ('og:image', 'twitter:image'))), None)
description = self._html_search_meta(
Expand Down

0 comments on commit 98e6231

Please sign in to comment.