Closed PasinduDushan closed 3 years ago
Hello, this lib never throws error with 429
status code. It is from ytdl-core
. Also, for TypeError: Cannot read property 'title' of null
, the search function returned null
. And for TypeError: Cannot read property 'searchOne' of undefined
, you need to import youtube-sr
like this:
const ytsr = require("youtube-sr").default
I added it but it still shows that error
Which error?
I uninstalled and installed the youtube-sr package again and I got this SyntaxError: Unexpected token '.'
. Also, my node version is 14
You sure? Try re-starting again. It wont throw errors like SyntaxError: Unexpected token '.'
for node.js v14
This is my full error.
url: item.channel.thumbnails?.default.url,
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/Groover-Data-Access/Music/filter.js:4:14)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/Groover-Data-Access/bot.js:80:19)
at Module._compile (internal/modules/cjs/loader.js:999:30)
(node:13850) UnhandledPromiseRejectionWarning: Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (/home/runner/Groover-Data-Access/node_modules/discord.js/src/sharding/Shard.js:158:16)
at Object.onceWrapper (events.js:421:26)
at Shard.emit (events.js:314:20)
at Shard.EventEmitter.emit (domain.js:483:12)
at Shard._handleExit (/home/runner/Groover-Data-Access/node_modules/discord.js/src/sharding/Shard.js:384:10)
at ChildProcess.emit (events.js:314:20)
at ChildProcess.EventEmitter.emit (domain.js:483:12)
at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
(node:13850) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:13850) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
And my node version is - v12.21.0 I'm using repl.it to host the bot
Yeah, you just said your node version is v12.21.0
. You need node.js v14 or higher to use this library.
I think repl can't be upgraded to a new node version. Are there any versions of youtube-sr to support node version 12.x
Try v3.x
ok
I tried version 3.0.0
and it says this error. TypeError: ytsr.searchOne is not a function
remove require("youtube-sr").default
and use require("youtube-sr")
only
It's removed alredy
It's not working
Going too back might not work. Try using v3.0.4
for now and you need to import it like this require("youtube-sr").default
for this version. But it should work for node.js v12. https://www.npmjs.com/package/youtube-sr/v/3.0.4
Yeah. It's showing all the things. It's throwing 429
but I don't think that it's a problem in youtube-sr
Already told ya 429
error comes from ytdl-core
. And, I think this issue is resolved
I think changing the package haven't worked. Because it's still showing cannot read property 'title' of null
You know searchOne
can return null
if it can't parse data right?
nvm. I got it. I tried on my local machine and it worked by upgrading node version
I've been using youtube-sr package for 2 months now and today I've got an error from my bot saying that
TypeError: Cannot read property 'title' of null
. When I tried again in 20-30 minutes it worked by showing all the song name and all other things but It hasn't played the song, It threw a429
error.MinigetError: input stream: Status code: 429
. It's too many requests so I waited for 20-30 minutes again and tried. When I try again it again showed an error. But this time it showedTypeError: Cannot read property 'searchOne' of undefined
. This is the code I used in my bot for playing music.Any help will be highly appreciated!