fix downloads
This commit is contained in:
parent
5d3a661d56
commit
6913e74f84
2 changed files with 22 additions and 5 deletions
|
|
@ -143,13 +143,31 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
|||
>
|
||||
<Share2 size={14} className="shrink-0" /> Post
|
||||
</button>
|
||||
<a
|
||||
href={videoUrl}
|
||||
download
|
||||
<button
|
||||
onClick={async (e) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
const response = await fetch(videoUrl);
|
||||
if (!response.ok) throw new Error('Download failed');
|
||||
const blob = await response.blob();
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.style.display = 'none';
|
||||
a.href = url;
|
||||
a.download = `clip-${index + 1}.mp4`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
document.body.removeChild(a);
|
||||
} catch (err) {
|
||||
console.error('Download error:', err);
|
||||
window.open(videoUrl, '_blank');
|
||||
}
|
||||
}}
|
||||
className="col-span-1 py-2 bg-white/5 hover:bg-white/10 text-zinc-300 hover:text-white rounded-lg text-xs font-medium transition-colors flex items-center justify-center gap-2 border border-white/5 truncate px-2"
|
||||
>
|
||||
<Download size={14} className="shrink-0" /> Download
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
1
main.py
1
main.py
|
|
@ -463,7 +463,6 @@ def download_youtube_video(url, output_dir="."):
|
|||
try:
|
||||
with open(cookies_path, 'w') as f:
|
||||
f.write(cookies_env)
|
||||
print(f"✅ Cookies written to {cookies_path}")
|
||||
except Exception as e:
|
||||
print(f"⚠️ Failed to write cookies file: {e}")
|
||||
cookies_path = None
|
||||
|
|
|
|||
Loading…
Reference in a new issue