threads-api
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -18,4 +18,8 @@ import { Extensions, Thread, ThreadsUser } from './threads-types'; | ||
}; | ||
export type ThreadsAPIOptions = { | ||
fbLSDToken?: string; | ||
}; | ||
export declare class ThreadsAPI { | ||
constructor(); | ||
fbLSDToken: string; | ||
constructor(options?: ThreadsAPIOptions); | ||
_getDefaultHeaders: (username: string) => { | ||
@@ -29,13 +33,2 @@ authority: string; | ||
referer: string; | ||
'sec-ch-prefers-color-scheme': string; | ||
'sec-ch-ua': string; | ||
'sec-ch-ua-full-version-list': string; | ||
'sec-ch-ua-mobile': string; | ||
'sec-ch-ua-platform': string; | ||
'sec-ch-ua-platform-version': string; | ||
'sec-fetch-dest': string; | ||
'sec-fetch-mode': string; | ||
'sec-fetch-site': string; | ||
'user-agent': string; | ||
'viewport-width': string; | ||
'x-asbd-id': string; | ||
@@ -42,0 +35,0 @@ 'x-fb-lsd': string; |
import axios from 'axios'; | ||
export class ThreadsAPI { | ||
constructor() { | ||
constructor(options) { | ||
this.fbLSDToken = 'NjppQDEgONsU_1LCzrmp6q'; // FIXME: Remove default value | ||
this._getDefaultHeaders = (username) => ({ | ||
@@ -12,15 +13,4 @@ authority: 'www.threads.net', | ||
referer: `https://www.threads.net/@${username}`, | ||
'sec-ch-prefers-color-scheme': 'dark', | ||
'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"', | ||
'sec-ch-ua-full-version-list': '"Not.A/Brand";v="8.0.0.0", "Chromium";v="114.0.5735.198", "Google Chrome";v="114.0.5735.198"', | ||
'sec-ch-ua-mobile': '?0', | ||
'sec-ch-ua-platform': '"macOS"', | ||
'sec-ch-ua-platform-version': '"13.0.0"', | ||
'sec-fetch-dest': 'empty', | ||
'sec-fetch-mode': 'cors', | ||
'sec-fetch-site': 'same-origin', | ||
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36', | ||
'viewport-width': '1728', | ||
'x-asbd-id': '129477', | ||
'x-fb-lsd': 'NjppQDEgONsU_1LCzrmp6q', | ||
'x-fb-lsd': this.fbLSDToken, | ||
'x-ig-app-id': '238260118697367', | ||
@@ -70,3 +60,3 @@ }); | ||
__comet_req: '29', | ||
lsd: 'NjppQDEgONsU_1LCzrmp6q', | ||
lsd: this.fbLSDToken, | ||
jazoest: '21997', | ||
@@ -106,3 +96,3 @@ __spin_r: '1007795914', | ||
__comet_req: '29', | ||
lsd: 'NjppQDEgONsU_1LCzrmp6q', | ||
lsd: this.fbLSDToken, | ||
jazoest: '21997', | ||
@@ -127,3 +117,6 @@ __spin_r: '1007795914', | ||
}; | ||
if (options?.fbLSDToken) { | ||
this.fbLSDToken = options.fbLSDToken; | ||
} | ||
} | ||
} |
{ | ||
"name": "threads-api", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Unofficial, Reverse-Engineered Node.js/TypeScript client for Meta's [Threads](https://threads.net).", | ||
@@ -8,3 +8,3 @@ "author": "Junho Yeo <i@junho.io>", | ||
"license": "MIT", | ||
"type": "module", | ||
"type": "commonjs", | ||
"source": "./src/index.ts", | ||
@@ -25,8 +25,16 @@ "types": "./build/index.d.ts", | ||
"dev": "yarn build && node build/test", | ||
"format": "prettier --write ." | ||
"format": "prettier --write .", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.22.8", | ||
"@babel/preset-env": "^7.22.7", | ||
"@trivago/prettier-plugin-sort-imports": "^4.1.1", | ||
"@types/jest": "^29.5.2", | ||
"@types/node": "^20.4.0", | ||
"babel-jest": "^29.6.1", | ||
"jest": "^29.6.1", | ||
"prettier": "^3.0.0", | ||
"ts-jest": "^29.1.1", | ||
"tslib": "^2.6.0", | ||
"typescript": "^5.1.6" | ||
@@ -33,0 +41,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38408
11
11
302
No