Using ytdl-core on the Front-End with ReactJS

I am trying to use ytdl-core with ReactJS on my Front-End to get the direct links of YouTube videos and then use them for getting the audio out of them, and video, and I also wanna put the audio on a tag. But the issue is that I get errors when I run:

useEffect(() => {
  (async () => {
    const stream = ytdl(LINK, {
      filter: "audioonly",
      format: "webm",
    }).on("error", (error) => console.log(error));
  })();
});

The error I get is: “Access to fetch at 'https://www.youtube.com/watch?v=blablablabl' 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 would really appreciate some help regarding that matter

I’ve tried to use corsAnywhere but I get an error from ytdl-core saying “not a YouTube domain”.
This is how I tried to implement it:

useEffect(() => {
  (async () => {
    const stream = ytdl(`https://cors-anywhere.herokuapp.com/${LINK}`, {
      filter: "audioonly",
      format: "webm",
    }).on("error", (error) => console.log(error));
  })();
});