diff options
author | Florrie <towerofnix@gmail.com> | 2017-10-27 10:36:11 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2017-10-27 10:36:49 -0300 |
commit | 735a18152295c081371b9bdccf78448f04765b36 (patch) | |
tree | 976515f0b0d23554bf0778f8ecc529f268cfd9e8 /src/crawl-youtube.js | |
parent | 7c125fb006af7f64043bd66305a3c41953a1b83c (diff) |
Add simple setup wizard (http-music setup)
..and create/update related man pages. Try it!
Diffstat (limited to 'src/crawl-youtube.js')
-rw-r--r-- | src/crawl-youtube.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/crawl-youtube.js b/src/crawl-youtube.js index 4b4c66c..38a531a 100644 --- a/src/crawl-youtube.js +++ b/src/crawl-youtube.js @@ -31,13 +31,20 @@ async function crawl(url) { } } -async function main(args) { +async function main(args, shouldReturn = false) { // TODO: Error message if none is passed. if (args.length === 0) { console.error("Usage: crawl-youtube <playlist URL>") + return + } + + const playlist = await crawl(args[0]) + const str = JSON.stringify(playlist, null, 2) + if (shouldReturn) { + return str } else { - console.log(JSON.stringify(await crawl(args[0]), null, 2)) + console.log(str) } } |