mirror of
https://github.com/vitalygashkov/crextractor.git
synced 2026-07-16 01:44:24 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbdde54471 | ||
|
|
777eb4ee2b | ||
|
|
b2c672dfa6 | ||
|
|
828f4fa1d5 | ||
|
|
8275aff35e | ||
|
|
1d8596b8c9 | ||
|
|
8658934ebe | ||
|
|
96e77102e3 | ||
|
|
673c276c9a | ||
|
|
ed80f46a45 | ||
|
|
e8468cafe9 | ||
|
|
50d84b208c | ||
|
|
3ed2207eaa | ||
|
|
980278acb9 | ||
|
|
485d330af2 | ||
|
|
50f77e0e7a | ||
|
|
00ba683170 | ||
|
|
d979333e13 | ||
|
|
1908ba60f5 | ||
|
|
45ab0a6085 | ||
|
|
17e9adf3b2 | ||
|
|
99d07dc063 | ||
|
|
c7a72f06a2 | ||
|
|
2ac5d94eb8 | ||
|
|
f2db789e75 | ||
|
|
a00b53007f | ||
|
|
38ac098adb | ||
|
|
5240fe25d5 | ||
|
|
50267e58a6 | ||
|
|
06e004b173 | ||
|
|
778dcc8098 | ||
|
|
6fee13a6c9 | ||
|
|
03c74c53a3 | ||
|
|
6152873a50 | ||
|
|
096da33282 | ||
|
|
c589d1d6da | ||
|
|
8550298dd1 | ||
|
|
9e4306408a | ||
|
|
dbdbe38471 | ||
|
|
8abe8eb654 | ||
|
|
c286e2b501 |
@@ -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
|
||||
@@ -1,5 +1,7 @@
|
||||
/node_modules
|
||||
.DS_Store
|
||||
/jadx-dist
|
||||
/jadx.zip
|
||||
/crunchyroll
|
||||
crunchyroll.apk
|
||||
crunchyroll.xapk
|
||||
|
||||
@@ -1,31 +1,34 @@
|
||||
# Crextractor
|
||||
|
||||
Utility for extracting credentials from the Crunchyroll Android 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
|
||||
|
||||
- [Node.js](https://nodejs.org/en)
|
||||
- [jadx](https://github.com/skylot/jadx)
|
||||
|
||||
## Installation
|
||||
## Usage
|
||||
|
||||
### Library
|
||||
|
||||
```bash
|
||||
npm i crextractor
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Fetching already extracted secrets
|
||||
#### Fetch ready credentials from this GitHub repository
|
||||
|
||||
```js
|
||||
async function main() {
|
||||
const url = 'https://raw.githubusercontent.com/vitalygashkov/crextractor/refs/heads/main/credentials.tv.json';
|
||||
const data = await fetch(url).then((response) => response.json());
|
||||
import { pull } from 'crextractor';
|
||||
|
||||
// You can use the extracted secrets to obtain access tokens for Crunchyroll APIs
|
||||
async function main() {
|
||||
const credentials = await pull('tv');
|
||||
|
||||
// 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: data.authorization,
|
||||
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)',
|
||||
// ...
|
||||
},
|
||||
@@ -37,17 +40,23 @@ async function main() {
|
||||
}
|
||||
```
|
||||
|
||||
#### Library
|
||||
#### 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 secrets
|
||||
// Do something with the extracted credentials
|
||||
}
|
||||
```
|
||||
|
||||
#### Command-line interface
|
||||
### Command-line interface
|
||||
|
||||
```bash
|
||||
npx crextractor --target mobile --output ./credentials.mobile.json
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": "3.89.2 (952)",
|
||||
"id": "n0q2nxl37zig0dqn0aio",
|
||||
"secret": "P0j3he4N8UG8W2w0-PvDadjGuv62fN2d",
|
||||
"encoded": "bjBxMm54bDM3emlnMGRxbjBhaW86UDBqM2hlNE44VUc4VzJ3MC1QdkRhZGpHdXY2MmZOMmQ=",
|
||||
"authorization": "Basic bjBxMm54bDM3emlnMGRxbjBhaW86UDBqM2hlNE44VUc4VzJ3MC1QdkRhZGpHdXY2MmZOMmQ="
|
||||
"version": "3.92.3 (977)",
|
||||
"id": "dvoxpszj59depczpxvwj",
|
||||
"secret": "_VQmMQlJw65tMCIT-SvM2r6OvBTs85Gf",
|
||||
"encoded": "ZHZveHBzemo1OWRlcGN6cHh2d2o6X1ZRbU1RbEp3NjV0TUNJVC1Tdk0ycjZPdkJUczg1R2Y=",
|
||||
"authorization": "Basic ZHZveHBzemo1OWRlcGN6cHh2d2o6X1ZRbU1RbEp3NjV0TUNJVC1Tdk0ycjZPdkJUczg1R2Y="
|
||||
}
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": "3.42.1 (22267)",
|
||||
"id": "bmbrkxyx3d7u6jsfyla4",
|
||||
"secret": "AIN4D5VE_cp0wVzfNoP0YqHUrYFp9hSg",
|
||||
"encoded": "Ym1icmt4eXgzZDd1NmpzZnlsYTQ6QUlONEQ1VkVfY3Awd1Z6Zk5vUDBZcUhVcllGcDloU2c=",
|
||||
"authorization": "Basic Ym1icmt4eXgzZDd1NmpzZnlsYTQ6QUlONEQ1VkVfY3Awd1Z6Zk5vUDBZcUhVcllGcDloU2c="
|
||||
"version": "3.45.2 (22274)",
|
||||
"id": "cb9nzrmht32vgtexygko",
|
||||
"secret": "KUwmMjJXxxursHITd1zvl2C2yQaQo8N4",
|
||||
"encoded": "Y2I5bnpybWh0MzJ2Z3RleHlna286S1V3bU1qSlh4eHVyc0hJVGQxenZsMkMyeVFhUW84TjQ=",
|
||||
"authorization": "Basic Y2I5bnpybWh0MzJ2Z3RleHlna286S1V3bU1qSlh4eHVyc0hJVGQxenZsMkMyeVFhUW84TjQ="
|
||||
}
|
||||
Vendored
+17
-3
@@ -1,10 +1,24 @@
|
||||
export function extractSecrets(): Promise<{
|
||||
export type CrunchyrollAppCredentials = {
|
||||
// Crunchyroll app ID
|
||||
id: string;
|
||||
// Crunchyroll app secret
|
||||
secret: string;
|
||||
// Base64 encoded `id:secret` 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;
|
||||
}>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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>;
|
||||
|
||||
+17
-9
@@ -16,13 +16,10 @@ const downloadMobileApk = async () => {
|
||||
|
||||
const downloadTvApk = async () => {
|
||||
const source = 'https://webservices.aptoide.com/webservices/3/getApkInfo';
|
||||
const formData = new FormData();
|
||||
formData.append('identif', 'id:71305225');
|
||||
formData.append('mode', 'json');
|
||||
const response = await fetch(source, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
});
|
||||
const body = new FormData();
|
||||
body.append('identif', 'id:72075737');
|
||||
body.append('mode', 'json');
|
||||
const response = await fetch(source, { method: 'POST', body });
|
||||
const json = await response.json();
|
||||
const url = json.apk.path;
|
||||
const filepath = join(process.cwd(), 'crunchyroll.apk');
|
||||
@@ -96,10 +93,15 @@ const parseVersion = async (decompiledDir) => {
|
||||
}
|
||||
};
|
||||
|
||||
const extract = async ({ target, output, cleanup = false } = {}) => {
|
||||
const extract = async ({ target = 'mobile', output, cleanup = false } = {}) => {
|
||||
console.log('Downloading APK...');
|
||||
const apkPath = target === 'tv' ? await downloadTvApk() : await downloadMobileApk();
|
||||
|
||||
if (!existsSync(apkPath)) {
|
||||
console.error('Unable to find APK (possibly a download error)');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Decompiling APK...');
|
||||
const decompiledDir = decompileApk(apkPath);
|
||||
|
||||
@@ -128,4 +130,10 @@ const extract = async ({ target, output, cleanup = false } = {}) => {
|
||||
return { version, id, secret, encoded, authorization };
|
||||
};
|
||||
|
||||
module.exports = { extract };
|
||||
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 };
|
||||
|
||||
Generated
+6
-6
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "crextractor",
|
||||
"version": "1.2.1",
|
||||
"version": "1.3.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "crextractor",
|
||||
"version": "1.2.1",
|
||||
"version": "1.3.4",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
@@ -15,7 +15,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"molnia": "^0.1.5"
|
||||
"molnia": "^0.1.7"
|
||||
},
|
||||
"bin": {
|
||||
"crextractor": "bin/cli.js"
|
||||
@@ -37,9 +37,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/molnia": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/molnia/-/molnia-0.1.5.tgz",
|
||||
"integrity": "sha512-Kb3bhlvNVWJ9Z8tGZGkhmChpXQY8OLFPkxXFvLJb+foLwfH7JyyJl+DbKuUKAIK1vnxs5sBFuQb3wxOIwWBpiA==",
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/molnia/-/molnia-0.1.7.tgz",
|
||||
"integrity": "sha512-wCezzcu2sRybrJb9ltrBEWwzO9NU2DRgxZw5Gr1g2QrnwrNo+olE3cAiD3Q1Y76rCde1qXBUmEuZ13aKXew+AQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "crextractor",
|
||||
"version": "1.2.1",
|
||||
"version": "1.3.4",
|
||||
"description": "Utility for extracting credentials from the Crunchyroll Android app",
|
||||
"main": "crextractor.js",
|
||||
"bin": {
|
||||
@@ -35,7 +35,7 @@
|
||||
"node": ">=20"
|
||||
},
|
||||
"dependencies": {
|
||||
"molnia": "^0.1.5"
|
||||
"molnia": "^0.1.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.9.2"
|
||||
|
||||
Reference in New Issue
Block a user