mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-14 07:04:27 -04:00
add link to media
This commit is contained in:
parent
a15a331798
commit
74189966bf
2 changed files with 5 additions and 3 deletions
|
@ -448,7 +448,8 @@ def fetch_media(link_dir, link, timeout=MEDIA_TIMEOUT, overwrite=False):
|
||||||
|
|
||||||
# import ipdb; ipdb.set_trace()
|
# import ipdb; ipdb.set_trace()
|
||||||
output = os.path.join(link_dir, 'media')
|
output = os.path.join(link_dir, 'media')
|
||||||
if os.path.exists(output) and not overwrite:
|
already_done = os.path.exists(output) and os.listdir(output)
|
||||||
|
if already_done and not overwrite:
|
||||||
return {'output': 'media', 'status': 'skipped'}
|
return {'output': 'media', 'status': 'skipped'}
|
||||||
|
|
||||||
os.makedirs(output, exist_ok=True)
|
os.makedirs(output, exist_ok=True)
|
||||||
|
@ -469,7 +470,7 @@ def fetch_media(link_dir, link, timeout=MEDIA_TIMEOUT, overwrite=False):
|
||||||
'--audio-quality', '320K',
|
'--audio-quality', '320K',
|
||||||
'--embed-thumbnail',
|
'--embed-thumbnail',
|
||||||
'--add-metadata',
|
'--add-metadata',
|
||||||
link['url']
|
link['url'],
|
||||||
]
|
]
|
||||||
|
|
||||||
end = progress(timeout, prefix=' ')
|
end = progress(timeout, prefix=' ')
|
||||||
|
@ -478,10 +479,10 @@ def fetch_media(link_dir, link, timeout=MEDIA_TIMEOUT, overwrite=False):
|
||||||
end()
|
end()
|
||||||
if result.returncode:
|
if result.returncode:
|
||||||
if b'ERROR: Unsupported URL' in result.stderr:
|
if b'ERROR: Unsupported URL' in result.stderr:
|
||||||
# print(' none found')
|
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
print(' got youtubedl response code {}:'.format(result.returncode))
|
print(' got youtubedl response code {}:'.format(result.returncode))
|
||||||
|
print(result.stderr)
|
||||||
raise Exception('Failed to download media')
|
raise Exception('Failed to download media')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
end()
|
end()
|
||||||
|
|
|
@ -187,6 +187,7 @@
|
||||||
Download:
|
Download:
|
||||||
<a href="index.json" title="JSON summary of archived link.">JSON</a> |
|
<a href="index.json" title="JSON summary of archived link.">JSON</a> |
|
||||||
<a href="." title="Webserver-provided index of files directory.">Files</a> |
|
<a href="." title="Webserver-provided index of files directory.">Files</a> |
|
||||||
|
<a href="media/" title="Audio, Video, and Subtitle files.">Media</a> |
|
||||||
<a href="git/" title="Any git repos at the url">Git Code</a>
|
<a href="git/" title="Any git repos at the url">Git Code</a>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue