// Name: Random Video From YouTube Channel
// Description: Open a random video from a specific YouTube Channel
// Author: Monica Powell
// Twitter: @indigitalcolor
``
import "@johnlindquist/kit"
let channelName = await arg("YouTube Channel Name (e.g, yogawithadriene):")
let videos = await scrapeSelector(
`https://www.youtube.com/c/${channelName}/videos`,
"a#video-title",
el => ({
name: el.innerText,
value: el.href,
})
)
let randomVideo = videos[Math.floor(Math.random() * videos.length)]
exec(`open "${randomVideo.value}"`)
Basically, this script is supposed to give you a prompt to type in a YouTube channel name. After that, it should automatically play a random video from that channel you specified. However, I'm not sure how to run this script. It keeps throwing up errors. Maybe, it can run only with a kit software as follows but it seems to be for MacOS only. https://www.scriptkit.com/ Currently the error I'm getting is as follows.
c:\RandomVideo>node RandomVideo.js
node:internal/errors:465
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@johnlindquist/kit' imported from c:\RandomVideo\RandomVideo.js
←[90m at new NodeError (node:internal/errors:372:5)←[39m
←[90m at packageResolve (node:internal/modules/esm/resolve:954:9)←[39m
←[90m at moduleResolve (node:internal/modules/esm/resolve:1003:20)←[39m
←[90m at defaultResolve (node:internal/modules/esm/resolve:1218:11)←[39m
←[90m at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)←[39m
←[90m at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)←[39m
←[90m at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)←[39m
←[90m at link (node:internal/modules/esm/module_job:78:36)←[39m {
code: ←[32m'ERR_MODULE_NOT_FOUND'←[39m
}