44 Commits
Author SHA1 Message Date
Vitaly Gashkov 50d84b208c 1.3.1 2025-09-20 22:19:07 +05:00
Vitaly Gashkov 3ed2207eaa chore: update tv credentials 2025-09-20 22:17:18 +05:00
Vitaly Gashkov 980278acb9 Merge branch 'main' of https://github.com/vitalygashkov/crunchys 2025-09-20 22:17:01 +05:00
Vitaly Gashkov 485d330af2 fix: update source for tv apk 2025-09-20 22:16:34 +05:00
vitalygashkovandgithub-actions[bot] 50f77e0e7a Apply automatic changes 2025-09-13 06:16:25 +00:00
Vitaly Gashkov 00ba683170 chore: update tv credentials manually 2025-09-06 22:04:12 +05:00
Vitaly Gashkov d979333e13 update workflow 2025-09-01 13:03:24 +05:00
Vitaly Gashkov 1908ba60f5 update workflow 2025-09-01 12:59:48 +05:00
Vitaly Gashkov 45ab0a6085 update workflow 2025-09-01 12:54:30 +05:00
Vitaly Gashkov 17e9adf3b2 update workflow 2025-09-01 12:48:03 +05:00
Vitaly Gashkov 99d07dc063 update workflow 2025-09-01 12:46:35 +05:00
Vitaly Gashkov c7a72f06a2 update workflow 2025-09-01 12:44:19 +05:00
Vitaly Gashkov 2ac5d94eb8 update workflow 2025-09-01 12:38:24 +05:00
Vitaly Gashkov f2db789e75 update workflow 2025-09-01 12:36:22 +05:00
Vitaly Gashkov a00b53007f update workflow 2025-09-01 12:34:13 +05:00
Vitaly Gashkov 38ac098adb update workflow 2025-09-01 12:29:22 +05:00
Vitaly Gashkov 5240fe25d5 fix 2 2025-09-01 12:22:58 +05:00
Vitaly Gashkov 50267e58a6 fix 2025-09-01 12:21:10 +05:00
Vitaly Gashkov 06e004b173 update gitignore 2025-08-26 19:10:31 +05:00
Vitaly Gashkov 778dcc8098 1.3.0 2025-08-26 12:22:37 +05:00
Vitaly Gashkov 6fee13a6c9 update README 2025-08-26 12:22:32 +05:00
Vitaly Gashkov 03c74c53a3 fix: improve types 2025-08-26 12:22:10 +05:00
Vitaly Gashkov 6152873a50 feat: add pull to fetch credentials from json in repo 2025-08-26 12:21:50 +05:00
Vitaly Gashkov 096da33282 fix(workflow): allow to write files to the repo 2025-08-25 23:00:37 +05:00
Vitaly Gashkov c589d1d6da update README 2025-08-25 22:59:34 +05:00
Vitaly Gashkov 8550298dd1 feat: add workflow with schedule to run credentials extracting every week 2025-08-25 22:56:39 +05:00
Vitaly Gashkov 9e4306408a update README 2025-08-24 10:43:44 +05:00
Vitaly Gashkov dbdbe38471 update README 2025-08-24 10:42:03 +05:00
Vitaly Gashkov 8abe8eb654 update README 2025-08-24 10:40:33 +05:00
Vitaly Gashkov c286e2b501 update README 2025-08-24 10:40:11 +05:00
Vitaly Gashkov 99f5efca66 fix: remove build step 2025-08-24 10:32:03 +05:00
Vitaly Gashkov 41b71bffb5 1.2.1 2025-08-24 10:30:22 +05:00
Vitaly Gashkov 94be27e20f build: add publish workflow 2025-08-24 10:29:26 +05:00
Vitaly Gashkov d03e9cadeb fix: change mobile apk source 2025-08-24 10:26:32 +05:00
Vitaly Gashkov eba50dccd0 chore: add extract scripts to package.json 2025-08-24 10:26:19 +05:00
Vitaly Gashkov 345dcd1e3b fix: cleanup by default 2025-08-24 10:26:02 +05:00
Vitaly Gashkov 451eaa54eb 1.2.0 2025-08-23 23:49:51 +05:00
Vitaly Gashkov 9a9b713682 update static credentials 2025-08-23 23:49:42 +05:00
Vitaly Gashkov 163993824a update README 2025-08-23 23:49:21 +05:00
Vitaly Gashkov 34b033ef57 update gitignore 2025-08-23 23:49:15 +05:00
Vitaly Gashkov 9c96d6f696 feat: support Android TV app 2025-08-23 23:49:07 +05:00
Vitaly Gashkov 9f53d6af9c update README 2025-08-23 21:38:36 +05:00
Vitaly Gashkov 6acf203edb update README 2025-08-23 21:28:46 +05:00
Vitaly Gashkov 2cd3fddd77 update package.json 2025-08-23 21:27:17 +05:00
13 changed files with 281 additions and 61 deletions
+1
View File
@@ -0,0 +1 @@
custom: ['t.me/tribute/app?startapp=dqW2']
+40
View File
@@ -0,0 +1,40 @@
name: Extract
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 6' # Runs every Saturday at 06:00 UTC
jobs:
extract:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Install JADX
run: |
JADX_VERSION=$(curl -s "https://api.github.com/repos/skylot/jadx/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
echo "Installing JADX version ${JADX_VERSION}..."
curl -Lo jadx.zip "https://github.com/skylot/jadx/releases/download/v${JADX_VERSION}/jadx-${JADX_VERSION}.zip"
unzip -q jadx.zip -d jadx-dist
echo "$(pwd)/jadx-dist/bin" >> $GITHUB_PATH
rm jadx.zip
- name: Install dependencies
run: npm install
- name: Extract app credentials
run: npm run extract:mobile && npm run extract:tv
- uses: stefanzweifel/git-auto-commit-action@v5
+51
View File
@@ -0,0 +1,51 @@
name: Publish
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/
- run: npm ci
# Extract version from package.json and determine release channel
- name: Parse version and determine release channel
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_OUTPUT
if [[ $VERSION == *"-alpha."* ]]; then
echo "NPM_TAG=alpha" >> $GITHUB_OUTPUT
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
elif [[ $VERSION == *"-beta."* ]]; then
echo "NPM_TAG=beta" >> $GITHUB_OUTPUT
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
else
echo "NPM_TAG=latest" >> $GITHUB_OUTPUT
fi
# Publish with the appropriate tag
- name: Publish to npm
run: npm publish --tag ${{ steps.version.outputs.NPM_TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Only create GitHub releases for stable versions
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
prerelease: ${{ steps.version.outputs.PRERELEASE == 'true' }}
token: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
+5
View File
@@ -1,2 +1,7 @@
/node_modules /node_modules
.DS_Store .DS_Store
/jadx-dist
/jadx.zip
/crunchyroll
crunchyroll.apk
crunchyroll.xapk
+42 -11
View File
@@ -1,37 +1,68 @@
# Crextractor # Crextractor
Utility for extracting secrets from Crunchyroll mobile app Utility for extracting credentials from the Crunchyroll Android app (both TV and mobile versions).
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).
## Prerequisites ## Prerequisites
- [Node.js](https://nodejs.org/en) - [Node.js](https://nodejs.org/en)
- [jadx](https://github.com/skylot/jadx) - [jadx](https://github.com/skylot/jadx)
## Installation ## Usage
### Library
```bash ```bash
npm i crextractor npm i crextractor
``` ```
## Usage #### Fetch ready credentials from this GitHub repository
#### Library
```js ```js
import { extractSecrets } from 'crextractor'; import { pull } from 'crextractor';
const { id, secret, encoded, header } = await extractSecrets(); async function main() {
const credentials = await pull('tv');
// Do something with the extracted secrets // You can use the extracted credentials to obtain access tokens for Crunchyroll APIs
const response = await fetch('https://beta-api.crunchyroll.com/auth/v1/token', {
headers: {
Authorization: credentials.authorization, // Ready HTTP header in the format `Basic <encoded>`, can be used to access some Crunchyroll APIs
'User-Agent': 'Crunchyroll/ANDROIDTV/3.42.1_22267 (Android 16; en-US; sdk_gphone64_x86_64)',
// ...
},
method: 'POST',
body: JSON.stringify({
// ...
}),
});
}
``` ```
#### Command-line interface #### Extract credentials from the latest APK using jadx
```js
import { extract } from 'crextractor';
async function main() {
const { id, secret, encoded, authorization } = await extract();
// id - Crunchyroll app ID
// secret - Crunchyroll app secret
// encoded - Base64 encoded `id:secret` string
// authorization - ready HTTP header in the format `Basic <encoded>`, can be used to access some Crunchyroll APIs
// Do something with the extracted credentials
}
```
### Command-line interface
```bash ```bash
npx crextractor npx crextractor --target mobile --output ./credentials.mobile.json
``` ```
> Results will be printed to the console and saved to `secrets.json` file > Results will be printed to the console and saved to `credentials.mobile.json` file. By default, the target is TV, but you can change it with `--target mobile` option.
## License ## License
+23 -2
View File
@@ -1,5 +1,26 @@
#!/usr/bin/env node #!/usr/bin/env node
const { extractSecrets } = require('../crextractor'); const { parseArgs } = require('node:util');
const { extract } = require('../crextractor');
extractSecrets({ output: 'secrets.json' }); const args = parseArgs({
options: {
target: {
type: 'string',
default: 'tv',
},
output: {
type: 'string',
},
cleanup: {
type: 'boolean',
default: true,
},
},
});
extract({
target: args.values.target,
output: args.values.output ?? (args.values.target === 'tv' ? 'credentials.tv.json' : 'credentials.mobile.json'),
cleanup: args.values.cleanup,
});
+7
View File
@@ -0,0 +1,7 @@
{
"version": "3.90.0 (955)",
"id": "bf70x6ihcc8hgzwsbvxi",
"secret": "x2cspPet3Zz5wJCtJrUCOIS9bzZwRCpc",
"encoded": "YmY3MHg2aWhjYzhoZ3p3c2J2eGk6eDJjc3BQZXQzWno1d0pDdEpyVUNPSVM5Ynpad1JDcGM=",
"authorization": "Basic YmY3MHg2aWhjYzhoZ3p3c2J2eGk6eDJjc3BQZXQzWno1d0pDdEpyVUNPSVM5Ynpad1JDcGM="
}
+7
View File
@@ -0,0 +1,7 @@
{
"version": "3.45.2 (22274)",
"id": "cb9nzrmht32vgtexygko",
"secret": "KUwmMjJXxxursHITd1zvl2C2yQaQo8N4",
"encoded": "Y2I5bnpybWh0MzJ2Z3RleHlna286S1V3bU1qSlh4eHVyc0hJVGQxenZsMkMyeVFhUW84TjQ=",
"authorization": "Basic Y2I5bnpybWh0MzJ2Z3RleHlna286S1V3bU1qSlh4eHVyc0hJVGQxenZsMkMyeVFhUW84TjQ="
}
+17 -3
View File
@@ -1,10 +1,24 @@
export function extractSecrets(): Promise<{ export type CrunchyrollAppCredentials = {
// Crunchyroll app ID // Crunchyroll app ID
id: string; id: string;
// Crunchyroll app secret // Crunchyroll app secret
secret: string; secret: string;
// Base64 encoded `id:secret` string // Base64 encoded `id:secret` string
encoded: string; encoded: string;
// HTTP header with Basic Authorization to access Crunchyroll mobile APIs // Ready HTTP header in the format `Basic <encoded>`, can be used to access some Crunchyroll APIs
authorization: string; authorization: string;
}>; };
/**
* Extract credentials from the Crunchyroll Android APK using jadx.
*/
export function extract(options?: {
target?: 'mobile' | 'tv';
output?: string;
cleanup?: boolean;
}): Promise<CrunchyrollAppCredentials>;
/**
* Fetch ready credentials from the GitHub repository.
*/
export function pull(options?: { target: 'mobile' | 'tv' }): Promise<CrunchyrollAppCredentials>;
+77 -34
View File
@@ -1,15 +1,31 @@
const { execSync } = require('node:child_process'); const { execSync } = require('node:child_process');
const { join } = require('node:path'); const { join } = require('node:path');
const { readdir, readFile, writeFile, rm } = require('node:fs/promises'); const { readdir, readFile, writeFile, rm } = require('node:fs/promises');
const { existsSync } = require('node:fs');
const { download } = require('molnia'); const { download } = require('molnia');
const downloadLatestApk = async () => { const downloadMobileApk = async () => {
const source = 'https://apkcombo.com/crunchyroll/com.crunchyroll.crunchyroid/download/apk'; const url = 'https://api.qqaoop.com/v11/apps/com.crunchyroll.crunchyroid/download?userId=1';
const page = await fetch(source); const filepath = join(process.cwd(), 'crunchyroll.apk');
const html = await page.text(); await download(url, {
const route = '/r2' + html.split('/r2')[1]?.split('"')[0]; output: filepath,
const url = `https://apkcombo.com${route}`; onError: (error) => console.error(error),
const filepath = join(process.cwd(), 'crunchyroll.xapk'); });
return filepath;
};
const downloadTvApk = async () => {
const source = 'https://webservices.aptoide.com/webservices/3/getApkInfo';
const formData = new FormData();
formData.append('identif', 'id:71666229');
formData.append('mode', 'json');
const response = await fetch(source, {
method: 'POST',
body: formData,
});
const json = await response.json();
const url = json.apk.path;
const filepath = join(process.cwd(), 'crunchyroll.apk');
await download(url, { await download(url, {
output: filepath, output: filepath,
onError: (error) => console.error(error), onError: (error) => console.error(error),
@@ -21,7 +37,7 @@ const decompileApk = (apkPath) => {
try { try {
execSync(`jadx ${apkPath}`, { stdio: 'inherit' }); execSync(`jadx ${apkPath}`, { stdio: 'inherit' });
} catch (error) {} } catch (error) {}
return apkPath.replace('.xapk', ''); return apkPath.replace('.xapk', '').replace('.apk', '');
}; };
const findConfigurationImpl = async (sourcesDir) => { const findConfigurationImpl = async (sourcesDir) => {
@@ -41,38 +57,59 @@ const findConfigurationImpl = async (sourcesDir) => {
} }
}; };
const parseSecrets = (contents) => { const parseCredentials = async (decompiledDir) => {
const lines = contents.split('\n'); const sourcesDir = join(decompiledDir, 'sources');
const startIndex = lines.findIndex((line) => line.includes('https://sso.crunchyroll.com')); const configurationImpl = await findConfigurationImpl(sourcesDir);
const endIndex = lines.findIndex((line) => line.includes('CR-AndroidMobile-SSAI-Prod')); if (configurationImpl) {
const results = lines const lines = configurationImpl.split('\n');
.slice(startIndex, endIndex) const startIndex = lines.findIndex((line) => line.includes('https://sso.crunchyroll.com'));
.map((line) => line.replaceAll(';', '')) const endIndex = lines.findIndex((line) => line.includes('CR-AndroidMobile-SSAI-Prod'));
.map((line) => line.replaceAll('"', '')) const results = lines
.map((line) => line.split('= ')[1]) .slice(startIndex, endIndex)
.map((line) => line.trim()); .map((line) => line.replaceAll(';', ''))
const [, , id, secret] = results; .map((line) => line.replaceAll('"', ''))
const encoded = Buffer.from(`${id}:${secret}`).toString('base64'); .map((line) => line.split('= ')[1])
const authorization = `Basic ${encoded}`; .map((line) => line.trim());
return { id, secret, encoded, authorization }; const [, , id, secret] = results;
if (id && secret) return { id, secret };
}
const constantsPath = join(decompiledDir, 'sources', 'com', 'crunchyroll', 'api', 'util', 'Constants.java');
const constants = await readFile(constantsPath, 'utf8');
return {
id: constants.split(' PROD_CLIENT_ID = "')[1].split('"')[0],
secret: constants.split(' PROD_CLIENT_SECRET = "')[1].split('"')[0],
};
}; };
const extractSecrets = async ({ output, cleanup = true } = {}) => { const parseVersion = async (decompiledDir) => {
console.log('Downloading latest APK...'); const manifestJsonPath = join(decompiledDir, 'resources', 'manifest.json');
const apkPath = await downloadLatestApk(); const manifestXmlPath = join(decompiledDir, 'resources', 'AndroidManifest.xml');
if (existsSync(manifestJsonPath)) {
const manifest = require(manifestJsonPath);
const version = `${manifest.version_name} (${manifest.version_code})`;
return version;
} else if (existsSync(manifestXmlPath)) {
const manifest = await readFile(manifestXmlPath, 'utf8');
const version = `${manifest.match(/versionName="([^"]+)"/)[1]} (${manifest.match(/versionCode="([^"]+)"/)[1]})`;
return version;
}
};
const extract = async ({ target = 'mobile', output, cleanup = false } = {}) => {
console.log('Downloading APK...');
const apkPath = target === 'tv' ? await downloadTvApk() : await downloadMobileApk();
console.log('Decompiling APK...'); console.log('Decompiling APK...');
const decompiledDir = decompileApk(apkPath); const decompiledDir = decompileApk(apkPath);
console.log('Searching for secrets...'); console.log('Parsing version...');
const sourcesDir = join(decompiledDir, 'sources'); const version = await parseVersion(decompiledDir);
const manifest = require(join(decompiledDir, 'resources', 'manifest.json'));
const version = manifest.version_name;
const configurationImpl = await findConfigurationImpl(sourcesDir);
if (!configurationImpl) throw new Error('Could not find ConfigurationImpl.kt');
console.log('Parsing secrets...'); console.log('Parsing credentials...');
const { id, secret, encoded, authorization } = parseSecrets(configurationImpl); const { id, secret } = await parseCredentials(decompiledDir);
const encoded = Buffer.from(`${id}:${secret}`).toString('base64');
const authorization = `Basic ${encoded}`;
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 });
@@ -91,4 +128,10 @@ const extractSecrets = async ({ output, cleanup = true } = {}) => {
return { version, id, secret, encoded, authorization }; return { version, id, secret, encoded, authorization };
}; };
module.exports = { extractSecrets }; const pull = async ({ target = 'mobile' } = {}) => {
const url = `https://raw.githubusercontent.com/vitalygashkov/crextractor/refs/heads/main/credentials.${target}.json`;
const credentials = await fetch(url).then((response) => response.json());
return credentials;
};
module.exports = { extract, pull };
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "crextractor", "name": "crextractor",
"version": "1.1.0", "version": "1.3.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "crextractor", "name": "crextractor",
"version": "1.1.0", "version": "1.3.1",
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
+9 -2
View File
@@ -1,15 +1,22 @@
{ {
"name": "crextractor", "name": "crextractor",
"version": "1.1.0", "version": "1.3.1",
"description": "Utility for extracting secrets from Crunchyroll mobile app", "description": "Utility for extracting credentials from the Crunchyroll Android app",
"main": "crextractor.js", "main": "crextractor.js",
"bin": { "bin": {
"crextractor": "bin/cli.js" "crextractor": "bin/cli.js"
}, },
"files": [
"bin",
"crextractor.d.ts",
"crextractor.js"
],
"types": "crextractor.d.ts", "types": "crextractor.d.ts",
"type": "commonjs", "type": "commonjs",
"scripts": { "scripts": {
"start": "node bin/cli.js", "start": "node bin/cli.js",
"extract:mobile": "node bin/cli.js --target mobile --output ./credentials.mobile.json",
"extract:tv": "node bin/cli.js --target tv --output ./credentials.tv.json",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"keywords": [ "keywords": [
-7
View File
@@ -1,7 +0,0 @@
{
"version": "3.89.1",
"id": "rybm7nqzc5zfynw7ayef",
"secret": "luDwBZArJNnVnGTJLuoXZufy5czXMWgr",
"encoded": "cnlibTducXpjNXpmeW53N2F5ZWY6bHVEd0JaQXJKTm5WbkdUSkx1b1hadWZ5NWN6WE1XZ3I=",
"authorization": "Basic cnlibTducXpjNXpmeW53N2F5ZWY6bHVEd0JaQXJKTm5WbkdUSkx1b1hadWZ5NWN6WE1XZ3I="
}