apithreads
Version:
Unofficial, Reverse-Engineered Node.js/TypeScript client for Meta's [Threads](https://threads.net).
1 lines • 4.78 kB
JavaScript
; Object.defineProperty(exports, "program", { enumerable: !0, get: function () { return e.program } }); var e = require("commander"); function r(e, r, t, n, i, o, s) { try { var a = e[o](s), l = a.value } catch (e) { t(e); return } a.done ? r(l) : Promise.resolve(l).then(n, i) } function t(e) { return function () { var t = this, n = arguments; return new Promise(function (i, o) { var s = e.apply(t, n); function a(e) { r(s, i, o, a, l, "next", e) } function l(e) { r(s, i, o, a, l, "throw", e) } a(void 0) }) } } function n(e, r) { var t, n, i, o, s = { label: 0, sent: function () { if (1 & i[0]) throw i[1]; return i[1] }, trys: [], ops: [] }; return o = { next: a(0), throw: a(1), return: a(2) }, "function" == typeof Symbol && (o[Symbol.iterator] = function () { return this }), o; function a(o) { return function (a) { return function (o) { if (t) throw TypeError("Generator is already executing."); for (; s;)try { if (t = 1, n && (i = 2 & o[0] ? n.return : o[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, o[1])).done) return i; switch (n = 0, i && (o = [2 & o[0], i.value]), o[0]) { case 0: case 1: i = o; break; case 4: return s.label++, { value: o[1], done: !1 }; case 5: s.label++, n = o[1], o = [0]; continue; case 7: o = s.ops.pop(), s.trys.pop(); continue; default: if (!(i = (i = s.trys).length > 0 && i[i.length - 1]) && (6 === o[0] || 2 === o[0])) { s = 0; continue } if (3 === o[0] && (!i || o[1] > i[0] && o[1] < i[3])) { s.label = o[1]; break } if (6 === o[0] && s.label < i[1]) { s.label = i[1], i = o; break } if (i && s.label < i[2]) { s.label = i[2], s.ops.push(o); break } i[2] && s.ops.pop(), s.trys.pop(); continue }o = r.call(e, s) } catch (e) { o = [6, e], n = 0 } finally { t = i = 0 } if (5 & o[0]) throw o[1]; return { value: o[0] ? o[1] : void 0, done: !0 } }([o, a]) } } } var i = new (require("./apithreads")).ThreadsAPI; e.program.version(require("../package.json").version, "-v, --version", "output the current version"), e.program.helpOption("-h, --help", "display help for command"), e.program.command("help").description("display help for command").action(function () { e.program.outputHelp() }), e.program.command("getUserIDfromUsername <username>").alias("userid").alias("uid").alias("id").description("get user ID from username").action(t(function (e) { return n(this, function (r) { switch (r.label) { case 0: return [4, i.getUserIDfromUsername(e, { timeout: 1e4 })]; case 1: return console.log("User ID for " + e + ": " + r.sent()), [2] } }) })), e.program.command("getUserProfile <username> <userID> [stringify]").alias("userprofile").alias("uprof").alias("up").description("get user profile").action(t(function (e, r, t) { var o; return n(this, function (n) { switch (n.label) { case 0: return [4, i.getUserProfile(e, r, { timeout: 1e4 })]; case 1: return o = n.sent(), console.log(t ? JSON.stringify(o, null, 5) : o), [2] } }) })), e.program.command("getUserProfileThreads <username> <userID> [stringify]").alias("uthreads").alias("ut").description("get user profile threads").action(t(function (e, r, t) { var o; return n(this, function (n) { switch (n.label) { case 0: return [4, i.getUserProfileThreads(e, r, { timeout: 1e4 })]; case 1: return o = n.sent(), console.log(t ? JSON.stringify(o, null, 5) : o), [2] } }) })), e.program.command("getUserProfileReplies <username> <userID> [stringify]").alias("userreplies").alias("ureplies").alias("ur").description("get user profile replies").action(t(function (e, r, t) { var o; return n(this, function (n) { switch (n.label) { case 0: return [4, i.getUserProfileReplies(e, r, { timeout: 1e4 })]; case 1: return o = n.sent(), console.log(t ? JSON.stringify(o, null, 5) : o), [2] } }) })), e.program.command("getPostIDfromURL <postURL>").alias("postid").alias("pid").alias("p").description("get post ID from URL").action(t(function (e) { return n(this, function (r) { switch (r.label) { case 0: return [4, i.getPostIDfromURL(e, { timeout: 1e4 })]; case 1: return console.log("Post ID for " + e + ": " + r.sent()), [2] } }) })), e.program.command("getThreads <postID> [stringify]").alias("threads").alias("t").description("get threads").action(t(function (e, r) { var t; return n(this, function (n) { switch (n.label) { case 0: return [4, i.getThreads(e, { timeout: 1e4 })]; case 1: return console.log(t = n.sent(), r ? JSON.stringify(t, null, 5) : t), [2] } }) })), e.program.command("getThreadLikers <postID> [stringify]").alias("threadlikers").alias("likers").alias("l").description("get thread likers").action(t(function (e, r) { var t; return n(this, function (n) { switch (n.label) { case 0: return [4, i.getThreadLikers(e, { timeout: 1e4 })]; case 1: return t = n.sent(), console.log(r ? JSON.stringify(t, null, 5) : t), [2] } }) }));