You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
constytpl=require('ytpl');constfirstResultBatch=awaitytpl('UU_aEa8K-EOJ3D6gOs7HcyNg',{pages: 1});constsecondResultBatch=ytpl.continueReq(firstResultBatch.continuation);constthirdResultBatch=ytpl.continueReq(secondResultBatch.continuation);// You can now use the .items property of all result batches e.g.:console.log(firstResultBatch.items);console.log(secondResultBatch.items);console.log(thirdResultBatch.items);`
SyntaxError: await is only valid in async function
ok then I rewtire 3 line without await (sure dumb solution but it work)
undefined
undefined
undefined
(node:15049) UnhandledPromiseRejectionWarning: Error: invalid continuation array
at AsyncFunction.main.continueReq (/home/dev/node_modules/ytpl/lib/main.js:131:56)
at Object.<anonymous> (/home/dev/Documents/getplaylist.js:4:32)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
(Use `node --trace-warnings ...` to show where the warning was created)
(node:15049) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async functionwithout 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:15049) [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.
(node:15049) UnhandledPromiseRejectionWarning: Error: invalid continuation array
at AsyncFunction.main.continueReq (/home/dev/node_modules/ytpl/lib/main.js:131:56)
at Object.<anonymous> (/home/dev/Documents/getplaylist.js:5:31)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
(node:15049) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async functionwithout 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: 2)
The text was updated successfully, but these errors were encountered:
🤔 looks like the example for ytpl.continueReq is invalid
that function should return a promise and therefor also require a promise
e.g.:
constytpl=require('ytpl');constfirstResultBatch=awaitytpl('UU_aEa8K-EOJ3D6gOs7HcyNg',{pages: 1});constsecondResultBatch=awaitytpl.continueReq(firstResultBatch.continuation);constthirdResultBatch=awaitytpl.continueReq(secondResultBatch.continuation);// You can now use the .items property of all result batches e.g.:console.log(firstResultBatch.items);console.log(secondResultBatch.items);console.log(thirdResultBatch.items);
Nodejs version: v14.17.6
I'm using standard code from the docs:
SyntaxError: await is only valid in async function
ok then I rewtire 3 line without await (sure dumb solution but it work)
and got a new errors
The text was updated successfully, but these errors were encountered: