aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/downloader/mhtml.py
diff options
context:
space:
mode:
Diffstat (limited to 'hypervideo_dl/downloader/mhtml.py')
-rw-r--r--hypervideo_dl/downloader/mhtml.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/hypervideo_dl/downloader/mhtml.py b/hypervideo_dl/downloader/mhtml.py
index f0f4dc6..c8332c0 100644
--- a/hypervideo_dl/downloader/mhtml.py
+++ b/hypervideo_dl/downloader/mhtml.py
@@ -114,8 +114,8 @@ body > figure > img {
fragment_base_url = info_dict.get('fragment_base_url')
fragments = info_dict['fragments'][:1] if self.params.get(
'test', False) else info_dict['fragments']
- title = info_dict['title']
- origin = info_dict['webpage_url']
+ title = info_dict.get('title', info_dict['format_id'])
+ origin = info_dict.get('webpage_url', info_dict['url'])
ctx = {
'filename': filename,
@@ -166,10 +166,15 @@ body > figure > img {
if (i + 1) <= ctx['fragment_index']:
continue
- fragment_url = urljoin(fragment_base_url, fragment['path'])
- success, frag_content = self._download_fragment(ctx, fragment_url, info_dict)
+ fragment_url = fragment.get('url')
+ if not fragment_url:
+ assert fragment_base_url
+ fragment_url = urljoin(fragment_base_url, fragment['path'])
+
+ success = self._download_fragment(ctx, fragment_url, info_dict)
if not success:
continue
+ frag_content = self._read_fragment(ctx)
mime_type = b'image/jpeg'
if frag_content.startswith(b'\x89PNG\r\n\x1a\n'):