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.10 to 1.0.11

1

build/threads-api.d.ts

@@ -74,2 +74,3 @@ import { AxiosRequestConfig } from 'axios';

getUserProfileReplies: (username: string, userID: string, options?: AxiosRequestConfig) => Promise<Thread[]>;
getPostIDfromThreadID: (threadID: string, options?: AxiosRequestConfig) => Promise<string | undefined>;
getPostIDfromURL: (postURL: string, options?: AxiosRequestConfig) => Promise<string | undefined>;

@@ -76,0 +77,0 @@ getThreads: (postID: string, options?: AxiosRequestConfig) => Promise<{

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,n,r,s,o){try{var i=e[s](o),l=i.value}catch(e){a(e);return}i.done?t(l):Promise.resolve(l).then(n,r)}function a(e){return function(){var a=this,n=arguments;return new Promise(function(r,s){var o=e.apply(a,n);function i(e){t(o,r,s,i,l,"next",e)}function l(e){t(o,r,s,i,l,"throw",e)}i(void 0)})}}function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}function r(e,t){var a,n,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=(r=o.trys).length>0&&r[r.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{a=r=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.noUpdateLSD=!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":o.fbLSDToken,"x-ig-app-id":"238260118697367"})};var i=this;this.getUserIDfromUsername=a(function(t,a){var s,o,l,c,u;return r(this,function(r){switch(r.label){case 0:return[4,e.default.get("https://www.instagram.com/"+t,n({},a,{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 c=null==(s=(l=(l=(l=r.sent().data).replace(/\s/g,"")).replace(/\n/g,"")).match(/"user_id":"(\d+)",/))?void 0:s[1],u=null==(o=l.match(/"LSD",\[\],{"token":"(\w+)"},\d+\]/))?void 0:o[1],!i.noUpdateLSD&&u&&(i.fbLSDToken=u,i.verbose&&console.debug("[fbLSDToken] UPDATED",i.fbLSDToken)),[2,c]}})});var l=this;this.getUserProfile=a(function(t,a,s){return r(this,function(r){switch(r.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"}),n({},s,{httpAgent:l.httpAgent,headers:n({},l._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileRootQuery"})}))];case 1:return[2,r.sent().data.data.userData.user]}})});var c=this;this.getUserProfileThreads=a(function(t,a,s){var o,i;return r(this,function(r){switch(r.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"}),n({},s,{httpAgent:c.httpAgent,headers:n({},c._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileThreadsTabQuery"})}))];case 1:return[2,(null==(i=r.sent().data.data)?void 0:null==(o=i.mediaData)?void 0:o.threads)||[]]}})});var u=this;this.getUserProfileReplies=a(function(t,a,s){var o,i;return r(this,function(r){switch(r.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"}),n({},s,{httpAgent:u.httpAgent,headers:n({},u._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileRepliesTabQuery"})}))];case 1:return[2,(null==(i=r.sent().data.data)?void 0:null==(o=i.mediaData)?void 0:o.threads)||[]]}})});var h=this;this.getPostIDfromURL=a(function(t,a){var s,o,i,l,c;return r(this,function(r){switch(r.label){case 0:return[4,e.default.get(t,n({},a,{httpAgent:h.httpAgent}))];case 1:return l=null==(s=(i=(i=(i=r.sent().data).replace(/\s/g,"")).replace(/\n/g,"")).match(/{"post_id":"(.*?)"}/))?void 0:s[1],c=null==(o=i.match(/"LSD",\[\],{"token":"(\w+)"},\d+\]/))?void 0:o[1],!h.noUpdateLSD&&c&&(h.fbLSDToken=c,h.verbose&&console.debug("[fbLSDToken] UPDATED",h.fbLSDToken)),[2,l]}})});var d=this;this.getThreads=a(function(t,a){return r(this,function(r){switch(r.label){case 0:return d.verbose&&console.debug("[fbLSDToken] USING",d.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:d.fbLSDToken,variables:'{"postID":"'+t+'"}',doc_id:"5587632691339264"}),n({},a,{httpAgent:d.httpAgent,headers:n({},d._getDefaultHeaders(),{"x-fb-friendly-name":"BarcelonaPostPageQuery"})}))];case 1:return[2,r.sent().data.data.data]}})});var f=this;this.getThreadLikers=a(function(t,a){return r(this,function(r){switch(r.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"}),n({},a,{httpAgent:f.httpAgent,headers:n({},f._getDefaultHeaders())}))];case 1:return[2,r.sent().data.data.likers]}})}),(null==t?void 0:t.fbLSDToken)&&(this.fbLSDToken=t.fbLSDToken),(null==t?void 0:t.noUpdateLSD)&&(this.noUpdateLSD=t.noUpdateLSD),this.verbose=(null==t?void 0:t.verbose)||!1,this.httpAgent=null==t?void 0:t.httpAgent};
"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.noUpdateLSD=!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;return n(this,function(n){switch(n.label){case 0:return[4,e.default.get("https://www.instagram.com/"+t,r({},a,{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 c=null==(s=(l=(l=(l=n.sent().data).replace(/\s/g,"")).replace(/\n/g,"")).match(/"user_id":"(\d+)",/))?void 0:s[1],u=null==(o=l.match(/"LSD",\[\],{"token":"(\w+)"},\d+\]/))?void 0:o[1],!i.noUpdateLSD&&u&&(i.fbLSDToken=u,i.verbose&&console.debug("[fbLSDToken] UPDATED",i.fbLSDToken)),[2,c]}})});var l=this;this.getUserProfile=a(function(t,a,s){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"}),r({},s,{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,s){var o,i;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"}),r({},s,{httpAgent:c.httpAgent,headers:r({},c._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileThreadsTabQuery"})}))];case 1:return[2,(null==(i=n.sent().data.data)?void 0:null==(o=i.mediaData)?void 0:o.threads)||[]]}})});var u=this;this.getUserProfileReplies=a(function(t,a,s){var o,i;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"}),r({},s,{httpAgent:u.httpAgent,headers:r({},u._getDefaultHeaders(t),{"x-fb-friendly-name":"BarcelonaProfileRepliesTabQuery"})}))];case 1:return[2,(null==(i=n.sent().data.data)?void 0:null==(o=i.mediaData)?void 0:o.threads)||[]]}})});var h=this;this.getPostIDfromThreadID=a(function(e,t){var a;return n(this,function(r){return a="https://www.threads.net/t/"+(e=(e=(e=e.split("?")[0]).replace(/\s/g,"")).replace(/\//g,"")),[2,h.getPostIDfromURL(a,t)]})});var d=this;this.getPostIDfromURL=a(function(t,a){var s,o,i,l,c;return n(this,function(n){switch(n.label){case 0:return[4,e.default.get(t,r({},a,{httpAgent:d.httpAgent}))];case 1:return l=null==(s=(i=(i=(i=n.sent().data).replace(/\s/g,"")).replace(/\n/g,"")).match(/{"post_id":"(.*?)"}/))?void 0:s[1],c=null==(o=i.match(/"LSD",\[\],{"token":"(\w+)"},\d+\]/))?void 0:o[1],!d.noUpdateLSD&&c&&(d.fbLSDToken=c,d.verbose&&console.debug("[fbLSDToken] UPDATED",d.fbLSDToken)),[2,l]}})});var f=this;this.getThreads=a(function(t,a){return n(this,function(n){switch(n.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:'{"postID":"'+t+'"}',doc_id:"5587632691339264"}),r({},a,{httpAgent:f.httpAgent,headers:r({},f._getDefaultHeaders(),{"x-fb-friendly-name":"BarcelonaPostPageQuery"})}))];case 1:return[2,n.sent().data.data.data]}})});var p=this;this.getThreadLikers=a(function(t,a){return n(this,function(n){switch(n.label){case 0:return p.verbose&&console.debug("[fbLSDToken] USING",p.fbLSDToken),[4,e.default.post("https://www.threads.net/api/graphql",new URLSearchParams({lsd:p.fbLSDToken,variables:'{"mediaID":"'+t+'"}',doc_id:"9360915773983802"}),r({},a,{httpAgent:p.httpAgent,headers:r({},p._getDefaultHeaders())}))];case 1:return[2,n.sent().data.data.likers]}})}),(null==t?void 0:t.fbLSDToken)&&(this.fbLSDToken=t.fbLSDToken),(null==t?void 0:t.noUpdateLSD)&&(this.noUpdateLSD=t.noUpdateLSD),this.verbose=(null==t?void 0:t.verbose)||!1,this.httpAgent=null==t?void 0:t.httpAgent};
{
"name": "threads-api",
"version": "1.0.10",
"version": "1.0.11",
"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