mirror of
https://github.com/vitalygashkov/crextractor.git
synced 2026-07-15 17:40:03 +02:00
fix: change apk source
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Crunchys
|
# Crextractor
|
||||||
|
|
||||||
A utility to extract secrets from Crunchyroll mobile app
|
Utility for extracting secrets from Crunchyroll mobile app
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ A utility to extract secrets from Crunchyroll mobile app
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm i crunchys
|
npm i crextractor
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -18,7 +18,7 @@ npm i crunchys
|
|||||||
#### Library
|
#### Library
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { extractSecrets } from 'crunchys';
|
import { extractSecrets } from 'crextractor';
|
||||||
|
|
||||||
const { id, secret, encoded, header } = await extractSecrets();
|
const { id, secret, encoded, header } = await extractSecrets();
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ const { id, secret, encoded, header } = await extractSecrets();
|
|||||||
#### Command-line interface
|
#### Command-line interface
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx crunchys
|
npx crextractor
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const { extractSecrets } = require('../crextractor');
|
||||||
|
|
||||||
|
extractSecrets({ output: 'secrets.json' });
|
||||||
Vendored
+2
-2
@@ -5,6 +5,6 @@ export function extractSecrets(): Promise<{
|
|||||||
secret: string;
|
secret: string;
|
||||||
// Base64 encoded `id:secret` string
|
// Base64 encoded `id:secret` string
|
||||||
encoded: string;
|
encoded: string;
|
||||||
// Basic `Authorization` header to access Crunchyroll mobile APIs
|
// HTTP header with Basic Authorization to access Crunchyroll mobile APIs
|
||||||
header: string;
|
authorization: string;
|
||||||
}>;
|
}>;
|
||||||
@@ -1,25 +1,20 @@
|
|||||||
const { join, basename } = require('node:path');
|
const { join } = require('node:path');
|
||||||
const { createWriteStream } = require('node:fs');
|
const { readdir, readFile, writeFile, rm } = require('node:fs/promises');
|
||||||
const { readdir, readFile, rm } = require('node:fs/promises');
|
const { download } = require('molnia');
|
||||||
const { execSync } = require('node:child_process');
|
|
||||||
const { Readable } = require('node:stream');
|
|
||||||
|
|
||||||
const downloadLatestApk = async () => {
|
const downloadLatestApk = async () => {
|
||||||
const source = 'https://www.apk20.com/apk/com.crunchyroll.crunchyroid/download/';
|
const source = 'https://apkcombo.com/crunchyroll/com.crunchyroll.crunchyroid/download/apk';
|
||||||
const page = await fetch(source);
|
const page = await fetch(source);
|
||||||
const html = await page.text();
|
const html = await page.text();
|
||||||
const url = html.split('<link rel="canonical" href="')[1]?.split('"')[0];
|
const route = '/r2' + html.split('/r2')[1]?.split('"')[0];
|
||||||
const id = url.split('/').reverse().at(0);
|
const url = `https://apkcombo.com${route}`;
|
||||||
const downloadUrl = `https://srv01.apk20.com/com.crunchyroll.crunchyroid.${id}.xapk`;
|
const filepath = join(process.cwd(), 'crunchyroll.xapk');
|
||||||
const fileName = basename(downloadUrl);
|
await download(url, {
|
||||||
const response = await fetch(downloadUrl);
|
output: filepath,
|
||||||
if (response.ok && response.body) {
|
onProgress: (progress) => console.log(progress),
|
||||||
const filePath = join(process.cwd(), fileName);
|
onError: (error) => console.error(error),
|
||||||
const writer = createWriteStream(filePath);
|
});
|
||||||
Readable.fromWeb(response.body).pipe(writer);
|
return filepath;
|
||||||
await new Promise((resolve) => writer.on('finish', resolve));
|
|
||||||
}
|
|
||||||
return join(process.cwd(), fileName);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const decompileApk = (apkPath) => {
|
const decompileApk = (apkPath) => {
|
||||||
@@ -58,11 +53,11 @@ const parseSecrets = (contents) => {
|
|||||||
.map((line) => line.trim());
|
.map((line) => line.trim());
|
||||||
const [, , id, secret] = results;
|
const [, , id, secret] = results;
|
||||||
const encoded = Buffer.from(`${id}:${secret}`).toString('base64');
|
const encoded = Buffer.from(`${id}:${secret}`).toString('base64');
|
||||||
const header = `Basic ${encoded}`;
|
const authorization = `Basic ${encoded}`;
|
||||||
return { id, secret, encoded, header };
|
return { id, secret, encoded, authorization };
|
||||||
};
|
};
|
||||||
|
|
||||||
const extractSecrets = async ({ cleanup = true } = {}) => {
|
const extractSecrets = async ({ output, cleanup = true } = {}) => {
|
||||||
console.log('Downloading latest APK...');
|
console.log('Downloading latest APK...');
|
||||||
const apkPath = await downloadLatestApk();
|
const apkPath = await downloadLatestApk();
|
||||||
|
|
||||||
@@ -71,21 +66,29 @@ const extractSecrets = async ({ cleanup = true } = {}) => {
|
|||||||
|
|
||||||
console.log('Searching for secrets...');
|
console.log('Searching for secrets...');
|
||||||
const sourcesDir = join(decompiledDir, 'sources');
|
const sourcesDir = join(decompiledDir, 'sources');
|
||||||
|
const manifest = require(join(sourcesDir, 'resources', 'manifest.json'));
|
||||||
|
const version = manifest.version_name;
|
||||||
const configurationImpl = await findConfigurationImpl(sourcesDir);
|
const configurationImpl = await findConfigurationImpl(sourcesDir);
|
||||||
if (!configurationImpl) return console.error('Could not find ConfigurationImpl.kt');
|
if (!configurationImpl) throw new Error('Could not find ConfigurationImpl.kt');
|
||||||
|
|
||||||
console.log('Parsing secrets...');
|
console.log('Parsing secrets...');
|
||||||
const { id, secret, encoded, header } = parseSecrets(configurationImpl);
|
const { id, secret, encoded, authorization } = parseSecrets(configurationImpl);
|
||||||
|
|
||||||
console.log(`Cleaning up files...`);
|
console.log(`Cleaning up files...`);
|
||||||
if (cleanup) await rm(apkPath, { recursive: true, force: true });
|
if (cleanup) await rm(apkPath, { recursive: true, force: true });
|
||||||
if (cleanup) await rm(decompiledDir, { recursive: true, force: true });
|
if (cleanup) await rm(decompiledDir, { recursive: true, force: true });
|
||||||
|
|
||||||
|
console.log(`Version: ${version}`);
|
||||||
console.log(`ID: ${id}`);
|
console.log(`ID: ${id}`);
|
||||||
console.log(`Secret: ${secret}`);
|
console.log(`Secret: ${secret}`);
|
||||||
console.log(`Encoded ID with secret: ${encoded}`);
|
console.log(`Encoded ID with secret: ${encoded}`);
|
||||||
|
console.log(`Authorization: ${authorization}`);
|
||||||
|
|
||||||
return { id, secret, encoded, header };
|
if (output) {
|
||||||
|
await writeFile(output, JSON.stringify({ version, id, secret, encoded, authorization }, null, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
return { version, id, secret, encoded, authorization };
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { extractSecrets };
|
module.exports = { extractSecrets };
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
const { extractSecrets } = require('./crunchys');
|
|
||||||
|
|
||||||
extractSecrets();
|
|
||||||
Generated
+73
-7
@@ -1,24 +1,81 @@
|
|||||||
{
|
{
|
||||||
"name": "crunchys",
|
"name": "crunchys",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "crunchys",
|
"name": "crunchys",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://boosty.to/vitalygashkov"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/vitalygashkov"
|
||||||
|
}
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"molnia": "^0.1.5"
|
||||||
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"crunchys": "cli.js"
|
"crunchys": "crunchys-cli.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.8.2"
|
"typescript": "^5.9.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fastq": {
|
||||||
|
"version": "1.19.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz",
|
||||||
|
"integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"reusify": "^1.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/molnia": {
|
||||||
|
"version": "0.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/molnia/-/molnia-0.1.5.tgz",
|
||||||
|
"integrity": "sha512-Kb3bhlvNVWJ9Z8tGZGkhmChpXQY8OLFPkxXFvLJb+foLwfH7JyyJl+DbKuUKAIK1vnxs5sBFuQb3wxOIwWBpiA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://t.me/tribute/app?startapp=dqW2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"fastq": "^1.19.1",
|
||||||
|
"undici": "^7.15.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"molnia": "molnia.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/reusify": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"iojs": ">=1.0.0",
|
||||||
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.8.2",
|
"version": "5.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
|
||||||
"integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
|
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -28,6 +85,15 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.17"
|
"node": ">=14.17"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"node_modules/undici": {
|
||||||
|
"version": "7.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici/-/undici-7.15.0.tgz",
|
||||||
|
"integrity": "sha512-7oZJCPvvMvTd0OlqWsIxTuItTpJBpU1tcbVl24FMn3xt3+VSunwUasmfPJRE57oNO1KsZ4PgA1xTdAX4hq8NyQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20.18.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-11
@@ -1,10 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "crunchys",
|
"name": "crextractor",
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"description": "A utility to extract secrets from Crunchyroll mobile app",
|
"description": "A utility to extract secrets from Crunchyroll mobile app",
|
||||||
"main": "crunchys.js",
|
"main": "crextractor.js",
|
||||||
"bin": "crunchys-cli.js",
|
"bin": {
|
||||||
"types": "crunchys.d.ts",
|
"crextractor": "bin/cli.js"
|
||||||
|
},
|
||||||
|
"types": "crextractor.d.ts",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
@@ -18,17 +20,16 @@
|
|||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
"url": "https://boosty.to/vitalygashkov"
|
"url": "https://t.me/tribute/app?startapp=dqW2"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "patreon",
|
|
||||||
"url": "https://www.patreon.com/vitalygashkov"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "20 || 21 || 22 || 23"
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"molnia": "^0.1.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.8.2"
|
"typescript": "^5.9.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user