diff options
author | Vitaly Takmazov | 2023-06-14 06:25:28 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-06-14 06:25:28 +0300 |
commit | 7dbd846c0df24d2ed45103d674d5ef361e6f23b3 (patch) | |
tree | 352f30a528653ecb72ed62de5737005c999a80ed /backup/index.js | |
parent | b9ada3e1ea4bac7c4fdb2a495678e8c96b242b7f (diff) |
backup: moved to `scripts` directory, cleanup lint warnings
Diffstat (limited to 'backup/index.js')
-rw-r--r-- | backup/index.js | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/backup/index.js b/backup/index.js deleted file mode 100644 index fccc4439..00000000 --- a/backup/index.js +++ /dev/null @@ -1,34 +0,0 @@ -var argv = require('minimist')(process.argv.slice(2)); - -if (typeof argv.u !== "string") { - console.log("username must be specified (-u ugnich)"); - process.exit(1); -} - -var messages = []; - -function getBlogData(blogUrl, callback) { - fetch(blogUrl) - .then(function(res) { - return res.json() - }) - .then(function(msgs) { - msgs.forEach(function(message) { - messages.push(message); - }); - if (msgs.length == 20) { - blog.searchParams.set("before_mid", msgs.slice(-1).pop().mid); - setTimeout(getBlogData, 1000, blog, callback); - } else { - callback(); - } - }); -}; - -var blog = new URL("https://api.juick.com/messages"); -blog.searchParams.append("uname", argv.u); - -getBlogData(blog, function() { - console.log(JSON.stringify(messages)); -}); - |