Error while downloading
Closed this issue · 6 comments
When I download, it throws an error saying TypeError: Cannot read properties of undefined (reading 'userAgent')
.
Turns out, when the ytStream
object is null, you need to add a guard to it. Replacing typeof ytstream.userAgent
on line 39, info.js with typeof ytstream?.userAgent
seems to do the trick. Line 46 of the same file seem to have the same issue as well and is quickly resolved using the same method!
Do you have an error stack?
Oh sorry I didn't take a screenshot of the error stack but I will try to submit a pull request!
Please check #10
Can you provide me the code you used so I can try to recreate the error?
For sure! It is using electron and express to create a local server that returns the google source URL.
The base URL is just "https://www.youtube.com/watch?v=" and ID is the id of the video.
app.get('/beta/stream/:id', async (req, res) => {
const yturl = `${BASE_YOUTUBE_URL}${req.params.id}`
const streamData = await stream(yturl, {
quality: "high",
type: "audio",
highWaterMark: 1048576 * 32
})
res.json({
raw: streamData.url
})
})
Hey! I've just released version 1.4.5 which should solve this issue.