talmobi / yt-search

97 stars 30 forks source link

Refused to set unsafe header [...] "accept-encoding" #40

Open kidsonfilms-python-rules opened 3 years ago

kidsonfilms-python-rules commented 3 years ago

I am using the single video search mode using a video ID.

Here is a snippet of my code.

var videoInfo = await yts({ videoId: v })
vidTitle = videoInfo.title
console.log(videoInfo)
songname.innerText = vidTitle;

When I do that, it returns the following error:

Refused to set unsafe header {My Directory Path} "accept-encoding"

I am using this in an Electron Renderer process if this helps.

talmobi commented 3 years ago

Hello there,

Sounds like a restriction from electron side. Try disabling the restriction or running it outside the render process (e.g. using electrons inter process communications).