crextractor 1.3.5 → 1.4.0
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 +22 -32
- package/bin/cli.js +2 -2
- package/crextractor.js +8 -7
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -4,32 +4,33 @@ Utility for extracting credentials from the Crunchyroll Android app (both TV and
|
|
|
4
4
|
|
|
5
5
|
The [credentials](https://github.com/vitalygashkov/crextractor/blob/main/credentials.tv.json) are [automatically](https://github.com/vitalygashkov/crextractor/actions/workflows/extract.yml) updated once a week (if there are any changes).
|
|
6
6
|
|
|
7
|
-
## Prerequisites
|
|
8
|
-
|
|
9
|
-
- [Node.js](https://nodejs.org/en)
|
|
10
|
-
- [jadx](https://github.com/skylot/jadx)
|
|
11
|
-
|
|
12
7
|
## Usage
|
|
13
8
|
|
|
14
|
-
###
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm i crextractor
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
#### Fetch ready credentials from this GitHub repository
|
|
9
|
+
### Fetch ready credentials from this GitHub repository
|
|
21
10
|
|
|
22
11
|
```js
|
|
23
|
-
|
|
12
|
+
// Supported targets: mobile, tv
|
|
13
|
+
async function fetchCredentials(target = 'tv') {
|
|
14
|
+
const url = `https://raw.githubusercontent.com/vitalygashkov/crextractor/refs/heads/main/credentials.${target}.json`;
|
|
15
|
+
return fetch(url).then((response) => response.json());
|
|
16
|
+
}
|
|
24
17
|
|
|
25
18
|
async function main() {
|
|
26
|
-
const credentials =
|
|
19
|
+
const credentials = fetchCredentials();
|
|
20
|
+
|
|
21
|
+
// You can use credentials to obtain access tokens for Crunchyroll APIs
|
|
22
|
+
|
|
23
|
+
// 3.54.5 (22304) -> 3.54.5_22304
|
|
24
|
+
const userAgentAppVersion = credentials.version
|
|
25
|
+
.replace(' ', '_')
|
|
26
|
+
.replace('(', '')
|
|
27
|
+
.replace(')', '');
|
|
27
28
|
|
|
28
|
-
// You can use the extracted credentials to obtain access tokens for Crunchyroll APIs
|
|
29
29
|
const response = await fetch('https://beta-api.crunchyroll.com/auth/v1/token', {
|
|
30
30
|
headers: {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
// Ready HTTP header in the format `Basic <encoded>`, can be used to access some Crunchyroll APIs
|
|
32
|
+
Authorization: credentials.authorization,
|
|
33
|
+
'User-Agent': `Crunchyroll/ANDROIDTV/${userAgentAppVersion} (Android 16; en-US; sdk_gphone64_x86_64)`,
|
|
33
34
|
// ...
|
|
34
35
|
},
|
|
35
36
|
method: 'POST',
|
|
@@ -40,23 +41,12 @@ async function main() {
|
|
|
40
41
|
}
|
|
41
42
|
```
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
### Extract fresh credentials from the latest APK using jadx
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
import { extract } from 'crextractor';
|
|
46
|
+
#### Prerequisites
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// id - Crunchyroll app ID
|
|
51
|
-
// secret - Crunchyroll app secret
|
|
52
|
-
// encoded - Base64 encoded `id:secret` string
|
|
53
|
-
// authorization - ready HTTP header in the format `Basic <encoded>`, can be used to access some Crunchyroll APIs
|
|
54
|
-
|
|
55
|
-
// Do something with the extracted credentials
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Command-line interface
|
|
48
|
+
- [Node.js](https://nodejs.org/en)
|
|
49
|
+
- [jadx](https://github.com/skylot/jadx)
|
|
60
50
|
|
|
61
51
|
```bash
|
|
62
52
|
npx crextractor --target mobile --output ./credentials.mobile.json
|
package/bin/cli.js
CHANGED
package/crextractor.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { readdir, readFile, writeFile, rm } from 'node:fs/promises';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { download } from 'molnia';
|
|
6
6
|
|
|
7
7
|
const downloadMobileApk = async () => {
|
|
8
8
|
const url = 'https://api.qqaoop.com/v11/apps/com.crunchyroll.crunchyroid/download?userId=1';
|
|
@@ -103,7 +103,8 @@ const parseVersion = async (decompiledDir) => {
|
|
|
103
103
|
const manifestJsonPath = join(decompiledDir, 'resources', 'manifest.json');
|
|
104
104
|
const manifestXmlPath = join(decompiledDir, 'resources', 'AndroidManifest.xml');
|
|
105
105
|
if (existsSync(manifestJsonPath)) {
|
|
106
|
-
const
|
|
106
|
+
const manifestContent = await readFile(manifestJsonPath, 'utf8');
|
|
107
|
+
const manifest = JSON.parse(manifestContent);
|
|
107
108
|
const version = `${manifest.version_name} (${manifest.version_code})`;
|
|
108
109
|
return version;
|
|
109
110
|
} else if (existsSync(manifestXmlPath)) {
|
|
@@ -159,4 +160,4 @@ const pull = async ({ target = 'mobile' } = {}) => {
|
|
|
159
160
|
return credentials;
|
|
160
161
|
};
|
|
161
162
|
|
|
162
|
-
|
|
163
|
+
export { extract, pull };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crextractor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Utility for extracting credentials from the Crunchyroll Android app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"crunchyroll"
|
|
@@ -29,9 +29,16 @@
|
|
|
29
29
|
"crextractor.d.ts",
|
|
30
30
|
"crextractor.js"
|
|
31
31
|
],
|
|
32
|
-
"type": "
|
|
32
|
+
"type": "module",
|
|
33
33
|
"main": "crextractor.js",
|
|
34
34
|
"types": "crextractor.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./crextractor.d.ts",
|
|
38
|
+
"import": "./crextractor.js",
|
|
39
|
+
"require": "./crextractor.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
35
42
|
"scripts": {
|
|
36
43
|
"start": "node bin/cli.js",
|
|
37
44
|
"extract:mobile": "node bin/cli.js --target mobile --output ./credentials.mobile.json",
|
|
@@ -46,7 +53,7 @@
|
|
|
46
53
|
"typescript": "^5.9.3"
|
|
47
54
|
},
|
|
48
55
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
56
|
+
"node": ">=24"
|
|
50
57
|
},
|
|
51
58
|
"readmeFilename": "README.md"
|
|
52
59
|
}
|