Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

threads-api

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

threads-api - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

43

build/threads-api.d.ts

@@ -69,14 +69,47 @@ import { Extensions, Thread, ThreadsUser } from './threads-types';

noUpdateLSD?: boolean;
proxy?: {
host: string;
port: number;
};
}) => Promise<string | undefined>;
getUserProfile: (username: string, userId: string) => Promise<ThreadsUser>;
getUserProfileThreads: (username: string, userId: string) => Promise<Thread[]>;
getUserProfileReplies: (username: string, userId: string) => Promise<Thread[]>;
getUserProfile: (username: string, userId: string, options?: {
proxy?: {
host: string;
port: number;
};
}) => Promise<ThreadsUser>;
getUserProfileThreads: (username: string, userId: string, options?: {
proxy?: {
host: string;
port: number;
};
}) => Promise<Thread[]>;
getUserProfileReplies: (username: string, userId: string, options?: {
proxy?: {
host: string;
port: number;
};
}) => Promise<Thread[]>;
getPostIDfromURL: (postURL: string, options?: {
noUpdateLSD?: boolean;
proxy?: {
host: string;
port: number;
};
}) => Promise<string | undefined>;
getThreads: (postID: string) => Promise<{
getThreads: (postID: string, options?: {
proxy?: {
host: string;
port: number;
};
}) => Promise<{
containing_thread: Thread;
reply_threads?: Thread[] | undefined;
}>;
getThreadLikers: (postID: string) => Promise<{
getThreadLikers: (postID: string, options?: {
proxy?: {
host: string;
port: number;
};
}) => Promise<{
users: ThreadsUser[];

@@ -83,0 +116,0 @@ }>;

2

build/threads-api.js

@@ -1,1 +0,1 @@

"use strict";!function(e,t){for(var a in t)Object.defineProperty(e,a,{enumerable:!0,get:t[a]})}(exports,{DEFAULT_LSD_TOKEN:function(){return s},ThreadsAPI:function(){return o}});var e=require("axios");function t(e,t,a,r,n,s,o){try{var i=e[s](o),l=i.value}catch(e){a(e);return}i.done?t(l):Promise.resolve(l).then(r,n)}function a(e){return function(){var a=this,r=arguments;return new Promise(function(n,s){var o=e.apply(a,r);function i(e){t(o,n,s,i,l,"next",e)}function l(e){t(o,n,s,i,l,"throw",e)}i(void 0)})}}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e}).apply(this,arguments)}function n(e,t){var a,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(s){return function(i){return function(s){if(a)throw TypeError("Generator is already executing.");for(;o;)try{if(a=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{a=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}}var s="NjppQDEgONsU_1LCzrmp6q",o=function(t){"use strict";var o=this;this.fbLSDToken=s,this.verbose=!1,this._getDefaultHeaders=function(e){return r({authority:"www.threads.net",accept:"*/*","accept-language":"ko","cache-control":"no-cache",origin:"https://www.threads.net",pragma:"no-cache"},e?{referer:"https://www.threads.net/@"+e}:void 0,{"x-asbd-id":"129477","x-fb-lsd":o.fbLSDToken,"x-ig-app-id":"238260118697367"})};var i=this;this.getUserIDfromUsername=a(function(t,a){var s,o,l,c,u,d;return n(this,function(n){switch(n.label){case 0:return[4,e.default.get("https://www.threads.net/@"+t,{httpAgent:i.httpAgent,headers:r({},i._getDefaultHeaders(t),{accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","accept-language":"ko,en;q=0.9,ko-KR;q=0.8,ja;q=0.7",pragma:"no-cache",referer:"https://www.instagram.com/","sec-fetch-dest":"document","sec-fetch-mode":"navigate","sec-fetch-site":"cross-site","sec-fetch-user":"?1","upgrade-insecure-requests":"1","x-asbd-id":void 0,"x-fb-lsd":void 0,"x-ig-app-id":void 0})})];case 1:return u=null==(s=(c=(c=(c=n.sent().data).replace(/\s/g,"")).replace(/\n/g,"")).match(/"props":{"user_id":"(\d+)"},/))?void 0:s[1],d=null==(o=c.match(/"LSD",\[\],{"token":"(\w+)"},\d+\]/))?void 0:o[1],!(null==(l=a)?void 0:l.noUpdateLSD)&&d&&(i.fbLSDToken=d,i.verbose&&console.debug("[fbLSDToken] UPDATED",i.fbLSDToken)),[2,u]}})});var l=this;this.getUserProfile=a(function(t,a){return n(this,function(n){switch(n.label){case 0:return l.verbose&&console.debug("[fbLSDToken] USING",l.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:l.fbLSDToken,variables:'{"userID":"'+a+'"}',doc_id:"23996318473300828"}),{httpAgent:l.httpAgent,headers:r({},l._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileRootQuery"})})];case 1:return[2,n.sent().data.data.userData.user]}})});var c=this;this.getUserProfileThreads=a(function(t,a){var s,o;return n(this,function(n){switch(n.label){case 0:return c.verbose&&console.debug("[fbLSDToken] USING",c.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:c.fbLSDToken,variables:'{"userID":"'+a+'"}',doc_id:"6232751443445612"}),{httpAgent:c.httpAgent,headers:r({},c._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileThreadsTabQuery"})})];case 1:return[2,(null==(o=n.sent().data.data)?void 0:null==(s=o.mediaData)?void 0:s.threads)||[]]}})});var u=this;this.getUserProfileReplies=a(function(t,a){var s,o;return n(this,function(n){switch(n.label){case 0:return u.verbose&&console.debug("[fbLSDToken] USING",u.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:u.fbLSDToken,variables:'{"userID":"'+a+'"}',doc_id:"6307072669391286"}),{httpAgent:u.httpAgent,headers:r({},u._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileRepliesTabQuery"})})];case 1:return[2,(null==(o=n.sent().data.data)?void 0:null==(s=o.mediaData)?void 0:s.threads)||[]]}})});var d=this;this.getPostIDfromURL=a(function(t,a){var r,s,o,i,l,c;return n(this,function(n){switch(n.label){case 0:return[4,e.default.get(t,{httpAgent:d.httpAgent})];case 1:return l=null==(r=(i=(i=(i=n.sent().data).replace(/\s/g,"")).replace(/\n/g,"")).match(/{"post_id":"(.*?)"}/))?void 0:r[1],c=null==(s=i.match(/"LSD",\[\],{"token":"(\w+)"},\d+\]/))?void 0:s[1],!(null==(o=a)?void 0:o.noUpdateLSD)&&c&&(d.fbLSDToken=c,d.verbose&&console.debug("[fbLSDToken] UPDATED",d.fbLSDToken)),[2,l]}})});var h=this;this.getThreads=a(function(t){return n(this,function(a){switch(a.label){case 0:return h.verbose&&console.debug("[fbLSDToken] USING",h.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:h.fbLSDToken,variables:'{"postID":"'+t+'"}',doc_id:"5587632691339264"}),{httpAgent:h.httpAgent,headers:r({},h._getDefaultHeaders(),{"x-fb-friendly-name":"BarcelonaPostPageQuery"})})];case 1:return[2,a.sent().data.data.data]}})});var f=this;this.getThreadLikers=a(function(t){return n(this,function(a){switch(a.label){case 0:return f.verbose&&console.debug("[fbLSDToken] USING",f.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:f.fbLSDToken,variables:'{"mediaID":"'+t+'"}',doc_id:"9360915773983802"}),{headers:r({},f._getDefaultHeaders())})];case 1:return[2,a.sent().data.data.likers]}})}),(null==t?void 0:t.fbLSDToken)&&(this.fbLSDToken=t.fbLSDToken),this.verbose=(null==t?void 0:t.verbose)||!1,this.httpAgent=null==t?void 0:t.httpAgent};
"use strict";!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(exports,{DEFAULT_LSD_TOKEN:function(){return o},ThreadsAPI:function(){return s}});var e=require("axios");function t(e,t,r,n,a,o,s){try{var i=e[o](s),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,a)}function r(e){return function(){var r=this,n=arguments;return new Promise(function(a,o){var s=e.apply(r,n);function i(e){t(s,a,o,i,l,"next",e)}function l(e){t(s,a,o,i,l,"throw",e)}i(void 0)})}}function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t){var r,n,a,o,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(r)throw TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=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(!(a=(a=s.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){s.label=o[1];break}if(6===o[0]&&s.label<a[1]){s.label=a[1],a=o;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(o);break}a[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}}var o="NjppQDEgONsU_1LCzrmp6q",s=function(t){"use strict";var s=this;this.fbLSDToken=o,this.verbose=!1,this._getDefaultHeaders=function(e){return n({authority:"www.threads.net",accept:"*/*","accept-language":"ko","cache-control":"no-cache",origin:"https://www.threads.net",pragma:"no-cache"},e?{referer:"https://www.threads.net/@"+e}:void 0,{"x-asbd-id":"129477","x-fb-lsd":s.fbLSDToken,"x-ig-app-id":"238260118697367"})};var i=this;this.getUserIDfromUsername=r(function(t,r){var o,s,l,u,c,d,h;return a(this,function(a){switch(a.label){case 0:return[4,e.default.get("https://www.instagram.com/"+t,{proxy:null==(o=r)?void 0:o.proxy,httpAgent:i.httpAgent,headers:n({},i._getDefaultHeaders(t),{accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","accept-language":"ko,en;q=0.9,ko-KR;q=0.8,ja;q=0.7",pragma:"no-cache",referer:"https://www.instagram.com/","sec-fetch-dest":"document","sec-fetch-mode":"navigate","sec-fetch-site":"cross-site","sec-fetch-user":"?1","upgrade-insecure-requests":"1","x-asbd-id":void 0,"x-fb-lsd":void 0,"x-ig-app-id":void 0})})];case 1:return d=null==(s=(c=(c=(c=a.sent().data).replace(/\s/g,"")).replace(/\n/g,"")).match(/"user_id":"(\d+)",/))?void 0:s[1],h=null==(l=c.match(/"LSD",\[\],{"token":"(\w+)"},\d+\]/))?void 0:l[1],!(null==(u=r)?void 0:u.noUpdateLSD)&&h&&(i.fbLSDToken=h,i.verbose&&console.debug("[fbLSDToken] UPDATED",i.fbLSDToken)),[2,d]}})});var l=this;this.getUserProfile=r(function(t,r,o){var s;return a(this,function(a){switch(a.label){case 0:return l.verbose&&console.debug("[fbLSDToken] USING",l.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:l.fbLSDToken,variables:'{"userID":"'+r+'"}',doc_id:"23996318473300828"}),{httpAgent:l.httpAgent,proxy:null==(s=o)?void 0:s.proxy,headers:n({},l._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileRootQuery"})})];case 1:return[2,a.sent().data.data.userData.user]}})});var u=this;this.getUserProfileThreads=r(function(t,r,o){var s,i,l;return a(this,function(a){switch(a.label){case 0:return u.verbose&&console.debug("[fbLSDToken] USING",u.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:u.fbLSDToken,variables:'{"userID":"'+r+'"}',doc_id:"6232751443445612"}),{httpAgent:u.httpAgent,proxy:null==(s=o)?void 0:s.proxy,headers:n({},u._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileThreadsTabQuery"})})];case 1:return[2,(null==(l=a.sent().data.data)?void 0:null==(i=l.mediaData)?void 0:i.threads)||[]]}})});var c=this;this.getUserProfileReplies=r(function(t,r,o){var s,i,l;return a(this,function(a){switch(a.label){case 0:return c.verbose&&console.debug("[fbLSDToken] USING",c.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:c.fbLSDToken,variables:'{"userID":"'+r+'"}',doc_id:"6307072669391286"}),{httpAgent:c.httpAgent,proxy:null==(s=o)?void 0:s.proxy,headers:n({},c._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileRepliesTabQuery"})})];case 1:return[2,(null==(l=a.sent().data.data)?void 0:null==(i=l.mediaData)?void 0:i.threads)||[]]}})});var d=this;this.getPostIDfromURL=r(function(t,r){var n,o,s,i,l,u,c;return a(this,function(a){switch(a.label){case 0:return[4,e.default.get(t,{proxy:null==(n=r)?void 0:n.proxy,httpAgent:d.httpAgent})];case 1:return u=null==(o=(l=(l=(l=a.sent().data).replace(/\s/g,"")).replace(/\n/g,"")).match(/{"post_id":"(.*?)"}/))?void 0:o[1],c=null==(s=l.match(/"LSD",\[\],{"token":"(\w+)"},\d+\]/))?void 0:s[1],!(null==(i=r)?void 0:i.noUpdateLSD)&&c&&(d.fbLSDToken=c,d.verbose&&console.debug("[fbLSDToken] UPDATED",d.fbLSDToken)),[2,u]}})});var h=this;this.getThreads=r(function(t,r){var o;return a(this,function(a){switch(a.label){case 0:return h.verbose&&console.debug("[fbLSDToken] USING",h.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:h.fbLSDToken,variables:'{"postID":"'+t+'"}',doc_id:"5587632691339264"}),{httpAgent:h.httpAgent,proxy:null==(o=r)?void 0:o.proxy,headers:n({},h._getDefaultHeaders(),{"x-fb-friendly-name":"BarcelonaPostPageQuery"})})];case 1:return[2,a.sent().data.data.data]}})});var f=this;this.getThreadLikers=r(function(t,r){var o;return a(this,function(a){switch(a.label){case 0:return f.verbose&&console.debug("[fbLSDToken] USING",f.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:f.fbLSDToken,variables:'{"mediaID":"'+t+'"}',doc_id:"9360915773983802"}),{httpAgent:f.httpAgent,proxy:null==(o=r)?void 0:o.proxy,headers:n({},f._getDefaultHeaders())})];case 1:return[2,a.sent().data.data.likers]}})}),(null==t?void 0:t.fbLSDToken)&&(this.fbLSDToken=t.fbLSDToken),this.verbose=(null==t?void 0:t.verbose)||!1,this.httpAgent=null==t?void 0:t.httpAgent};
{
"name": "threads-api",
"version": "1.0.8",
"version": "1.0.9",
"description": "Unofficial, Reverse-Engineered Node.js/TypeScript client for Meta's [Threads](https://threads.net).",

@@ -5,0 +5,0 @@ "author": "Junho Yeo <i@junho.io>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc