emusks 2.0.12 → 2.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/package.json +5 -5
- package/src/clients.js +40 -7
- package/src/helpers/media.js +15 -2
package/README.md
CHANGED
|
@@ -3,4 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
Log in and interact with the unofficial X API using any client identity — web, Android, iOS, or TweetDeck
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
officially dmca'd by twitter™ 🏆 • includes a few leaked ads bearers
|
|
7
|
+
|
|
8
|
+
[Learn more →](https://emusks.tiago.zip) [Codeberg](https://codeberg.org/tiag/emusks)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emusks",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"description": "Reverse-engineered Twitter API client. Log in and interact with the unofficial X API using any client identity — web, Android, iOS, or TweetDeck",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"client",
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"x",
|
|
11
11
|
"x-api"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://emusks.tiago.zip",
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://
|
|
15
|
+
"url": "https://codeberg.org/tiag/emusks/issues"
|
|
16
16
|
},
|
|
17
17
|
"license": "AGPL-3.0-only",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://
|
|
20
|
+
"url": "https://codeberg.org/tiag/emusks.git"
|
|
21
21
|
},
|
|
22
22
|
"type": "module",
|
|
23
23
|
"main": "src/index.js",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"cycletls": "^2.0.5",
|
|
29
|
-
"x-client-transaction-id": "^0.
|
|
29
|
+
"x-client-transaction-id": "^0.2.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/clients.js
CHANGED
|
@@ -4,18 +4,14 @@ const chrome_fingerprint = {
|
|
|
4
4
|
ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,35-5-27-16-0-10-13-23-45-65037-17613-18-65281-51-43-11,4588-29-23-24,0",
|
|
5
5
|
ja4r: "t13d1516h2_002f,0035,009c,009d,1301,1302,1303,c013,c014,c02b,c02c,c02f,c030,cca8,cca9_0005,000a,000b,000d,0012,0017,001b,0023,002b,002d,0033,44cd,fe0d,ff01_0403,0804,0401,0503,0805,0501,0806,0601",
|
|
6
6
|
};
|
|
7
|
-
|
|
8
7
|
const android_fingerprint = {
|
|
9
8
|
ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,23-0-16-11-17613-27-43-35-13-65037-51-18-65281-45-5-10-41,4588-29-23-24,0",
|
|
10
9
|
ja4r: "t13d1517h2_002f,0035,009c,009d,1301,1302,1303,c013,c014,c02b,c02c,c02f,c030,cca8,cca9_0005,000a,000b,000d,0012,0017,001b,0023,0029,002b,002d,0033,44cd,fe0d,ff01_0403,0804,0401,0503,0805,0501,0806,0601",
|
|
11
|
-
|
|
12
10
|
userAgent: "TwitterAndroid/10.93.0-release.00 (Android 14; Google Pixel 7 Pro)",
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
const iphone_fingerprint = {
|
|
16
13
|
ja3: "771,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,23-0-16-11-17613-27-43-35-13-65037-51-18-65281-45-5-10-41,4588-29-23-24,0",
|
|
17
14
|
ja4r: "t13d1517h2_002f,0035,009c,009d,1301,1302,1303,c013,c014,c02b,c02c,c02f,c030,cca8,cca9_0005,000a,000b,000d,0012,0017,001b,0023,0029,002b,002d,0033,44cd,fe0d,ff01_0403,0804,0401,0503,0805,0501,0806,0601",
|
|
18
|
-
|
|
19
15
|
userAgent: "Twitter-iPhone/10.93.0-release.00 (iPhone; iOS 16.5.1; Scale/3.00)",
|
|
20
16
|
};
|
|
21
17
|
|
|
@@ -41,14 +37,14 @@ export default {
|
|
|
41
37
|
"AAAAAAAAAAAAAAAAAAAAAIWCCAAAAAAA2C25AxqI%2BYCS7pdfJKRH8Xh19zA%3D8vpDZzPHaEJhd20MKVWp3UR38YoPpuTX7UD2cVYo3YNikubuxd",
|
|
42
38
|
fingerprints: iphone_fingerprint,
|
|
43
39
|
},
|
|
44
|
-
|
|
45
40
|
old: {
|
|
46
|
-
// doesn't seem to work
|
|
41
|
+
// v1.1 only - doesn't seem to work
|
|
47
42
|
bearer:
|
|
48
43
|
"AAAAAAAAAAAAAAAAAAAAAPYXBAAAAAAACLXUNDekMxqa8h%2F40K4moUkGsoc%3DTYfbDKbT3jJPCEVnMYqilB28NHfOPqkca3qaAxGfsyKCs0wRbw",
|
|
49
44
|
fingerprints: chrome_fingerprint,
|
|
50
45
|
},
|
|
51
46
|
web: {
|
|
47
|
+
// requires transaction id
|
|
52
48
|
bearer:
|
|
53
49
|
"AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
54
50
|
fingerprints: chrome_fingerprint,
|
|
@@ -59,4 +55,41 @@ export default {
|
|
|
59
55
|
"AAAAAAAAAAAAAAAAAAAAAFQODgEAAAAAVHTp76lzh3rFzcHbmHVvQxYYpTw%3DckAlMINMjmCwxUcaXbAN4XqJVdgMJaHqNOFgPMK0zN1qLqLQCF",
|
|
60
56
|
fingerprints: chrome_fingerprint,
|
|
61
57
|
},
|
|
62
|
-
|
|
58
|
+
advertisers: {
|
|
59
|
+
bearer:
|
|
60
|
+
"AAAAAAAAAAAAAAAAAAAAAPnA9gAAAAAAZHpqKYoDdMCaqTUBktzAdK38BGk%3DLNsI9r2BHSjZ7cl5wD6Sh6NhxwZd2j8lXDSd6GDoQVYBlzx5Ff",
|
|
61
|
+
fingerprints: chrome_fingerprint,
|
|
62
|
+
},
|
|
63
|
+
ads_manager_next: {
|
|
64
|
+
bearer:
|
|
65
|
+
"AAAAAAAAAAAAAAAAAAAAAFsXTQEAAAAAGT1ZWWC51IF1Z8pIl9GKdGuGYtY%3Darf4lbyvoKjCUZfpLX90hOjVT1PqmxNH3arG6iOcb4XNlCvQxe",
|
|
66
|
+
fingerprints: chrome_fingerprint,
|
|
67
|
+
},
|
|
68
|
+
advertiser_interface: {
|
|
69
|
+
bearer:
|
|
70
|
+
"AAAAAAAAAAAAAAAAAAAAAFktLQEAAAAAidmFlKJvQR29CW13eg2VolZ3wy4%3DU2ufD1swpIdjuNtaIzloCW8VnUYsmyuTatng49FzHuRwEeDdKH",
|
|
71
|
+
fingerprints: chrome_fingerprint,
|
|
72
|
+
},
|
|
73
|
+
corporate_cms: {
|
|
74
|
+
// known by twitter employees
|
|
75
|
+
bearer:
|
|
76
|
+
"AAAAAAAAAAAAAAAAAAAAACHguwAAAAAAaSlT0G31NDEyg%2BSnBN5JuyKjMCU%3Dlhg0gv0nE7KKyiJNEAojQbn8Y3wJm1xidDK7VnKGBP4ByJwHPb",
|
|
77
|
+
fingerprints: chrome_fingerprint,
|
|
78
|
+
},
|
|
79
|
+
ads_broken: {
|
|
80
|
+
// doesn't work
|
|
81
|
+
bearer:
|
|
82
|
+
"AAAAAAAAAAAAAAAAAAAAAG5LOQEAAAAAbEKsIYYIhrfOQqm4H8u7xcahRkU%3Dz98HKmzbeXdKqBfUDmElcqYl0cmmKY9KdS2UoNIz3Phapgsowi",
|
|
83
|
+
fingerprints: chrome_fingerprint,
|
|
84
|
+
},
|
|
85
|
+
audience_manager_internal: {
|
|
86
|
+
bearer:
|
|
87
|
+
"AAAAAAAAAAAAAAAAAAAAADLR6gAAAAAAVkXGYss9CqHyAQ%2FMecX43S1FhwA%3DYUynbBpK0xqHXNeDxFt3NkoFwkS45LTzvgE3CJTfRbQ3QOSO7f",
|
|
88
|
+
fingerprints: chrome_fingerprint,
|
|
89
|
+
},
|
|
90
|
+
tweets_manager: {
|
|
91
|
+
bearer:
|
|
92
|
+
"AAAAAAAAAAAAAAAAAAAAADiN8wAAAAAAeBRmNg1NMB%2F4KdNvC%2FpQD0jjTEI%3Dosq5IVDr4azvJ2wThXtkMbGu8powFlXBRgQD9yTttGtygMk7ki",
|
|
93
|
+
fingerprints: chrome_fingerprint,
|
|
94
|
+
},
|
|
95
|
+
};
|
package/src/helpers/media.js
CHANGED
|
@@ -71,10 +71,11 @@ async function makeUploadRequest(instance, method, params, body, extraHeaders =
|
|
|
71
71
|
"x-twitter-active-user": "yes",
|
|
72
72
|
"x-twitter-auth-type": "OAuth2Session",
|
|
73
73
|
"x-twitter-client-language": "en",
|
|
74
|
+
origin: "https://x.com",
|
|
74
75
|
priority: "u=1, i",
|
|
75
|
-
"sec-ch-ua": "Not(A:Brand;v=8, Chromium;v=144",
|
|
76
|
+
"sec-ch-ua": '"Not(A:Brand";v="8", "Chromium";v="144"',
|
|
76
77
|
"sec-ch-ua-mobile": "?0",
|
|
77
|
-
"sec-ch-ua-platform": "macOS",
|
|
78
|
+
"sec-ch-ua-platform": '"macOS"',
|
|
78
79
|
"sec-fetch-dest": "empty",
|
|
79
80
|
"sec-fetch-mode": "cors",
|
|
80
81
|
"sec-fetch-site": "same-site",
|
|
@@ -85,6 +86,14 @@ async function makeUploadRequest(instance, method, params, body, extraHeaders =
|
|
|
85
86
|
...extraHeaders,
|
|
86
87
|
};
|
|
87
88
|
|
|
89
|
+
if (instance.auth.generateTransactionId) {
|
|
90
|
+
const uploadUrl = new URL(url);
|
|
91
|
+
headers["x-client-transaction-id"] = await instance.auth.generateTransactionId(
|
|
92
|
+
method.toUpperCase(),
|
|
93
|
+
uploadUrl.pathname,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
88
97
|
return await cycleTLS(
|
|
89
98
|
url,
|
|
90
99
|
{
|
|
@@ -140,6 +149,10 @@ export async function create(source, opts = {}) {
|
|
|
140
149
|
media_category: category,
|
|
141
150
|
});
|
|
142
151
|
|
|
152
|
+
if (initRes.status !== 200 && initRes.status !== 202) {
|
|
153
|
+
const text = typeof initRes.body === "string" ? initRes.body : await initRes.text();
|
|
154
|
+
throw new Error(`upload INIT failed (HTTP ${initRes.status}): ${text}`);
|
|
155
|
+
}
|
|
143
156
|
const initData = await initRes.json();
|
|
144
157
|
if (!initData?.media_id_string) {
|
|
145
158
|
throw new Error(`upload INIT failed: ${JSON.stringify(initData)}`);
|