Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3642

Facing CORS error while trying to download a video using youtube-dl-exec in the frontend [duplicate]

$
0
0
const url = new Blob(\[selectedLink\]);const response = await fetch(selectedLink);const blob = await response.blob();const link = document.createElement('a');link.href = window.URL.createObjectURL(blob);link.download = title;document.body.appendChild(link);

enter image description here

I am working on a project where I use the youtube-dl-exec Node package to obtain a temporary link for a selected video quality. I have successfully retrieved the correct link, but when I attempt to download the video in the frontend, I encounter a CORS error.

The error occurs at the fetch call with the following message:

Access to fetch at "some temp link" from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I need assistance in resolving this CORS issue and successfully downloading the video using the obtained link in the frontend. Any guidance or suggestions would be greatly appreciated. Thank you!


Viewing all articles
Browse latest Browse all 3642

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>