diff options
Diffstat (limited to 'src/crawl-http.js')
-rwxr-xr-x | src/crawl-http.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/crawl-http.js b/src/crawl-http.js index 4925f12..d3e1533 100755 --- a/src/crawl-http.js +++ b/src/crawl-http.js @@ -147,7 +147,7 @@ function getHTMLLinks(text) { }) } -async function main(args) { +async function main(args, shouldReturn = false) { if (args.length === 0) { console.log("Usage: crawl-http http://.../example/path/ [opts]") return @@ -202,7 +202,12 @@ async function main(args) { filterRegex: filterRegex }) - console.log(JSON.stringify(downloadedPlaylist, null, 2)) + const str = JSON.stringify(downloadedPlaylist, null, 2) + if (shouldReturn) { + return str + } else { + console.log(str) + } } module.exports = {main, crawl} |