Open rx570gtx1060 opened 2 years ago
What was the error
const playlist = await getYoutubePlaylist(url); ^^^^^
SyntaxError: await is only valid in async functions and the top level bodies of modules at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1026:15) at Module._compile (node:internal/modules/cjs/loader:1061:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47
if you want to use await
at top level, you need node 16. Try this instead
getYoutubePlaylist(URL).then(playlist => console.log(playlist));
2
Running the file still didn't work. Here is my syntax
const { getYoutubePlaylist } = require('extract-sptf-playlist'); const url = '';
const playlist = await getYoutubePlaylist(url, { filePath: '2data.json', displayProcess: true, headless: true});