mirror of
https://github.com/vitalygashkov/crextractor.git
synced 2026-07-16 01:44:24 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
778dcc8098 | ||
|
|
6fee13a6c9 | ||
|
|
03c74c53a3 | ||
|
|
6152873a50 | ||
|
|
096da33282 | ||
|
|
c589d1d6da | ||
|
|
8550298dd1 | ||
|
|
9e4306408a | ||
|
|
dbdbe38471 | ||
|
|
8abe8eb654 | ||
|
|
c286e2b501 | ||
|
|
99f5efca66 | ||
|
|
41b71bffb5 | ||
|
|
94be27e20f | ||
|
|
d03e9cadeb | ||
|
|
eba50dccd0 | ||
|
|
345dcd1e3b |
@@ -0,0 +1 @@
|
|||||||
|
custom: ['t.me/tribute/app?startapp=dqW2']
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
name: Extract
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 4 * * 1' # Runs every Monday at 04:00 UTC
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
extract:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||||
|
# added or changed files to the repository.
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# JADX requires Java 11 or higher to run
|
||||||
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '17'
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
# Download and install the latest version of JADX
|
||||||
|
- name: Install JADX
|
||||||
|
run: |
|
||||||
|
# Fetch the latest version tag from the JADX GitHub repository
|
||||||
|
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}..."
|
||||||
|
|
||||||
|
# Download the release zip file
|
||||||
|
curl -Lo jadx.zip "https://github.com/skylot/jadx/releases/download/v${JADX_VERSION}/jadx-${JADX_VERSION}.zip"
|
||||||
|
|
||||||
|
# Unzip the archive
|
||||||
|
unzip -q jadx.zip -d jadx-dist
|
||||||
|
|
||||||
|
# Add the JADX bin directory to the GitHub Actions path
|
||||||
|
# This makes the 'jadx' command available in subsequent steps
|
||||||
|
echo "$(pwd)/jadx-dist/jadx-${JADX_VERSION}/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
# Clean up the downloaded zip file
|
||||||
|
rm jadx.zip
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# Verify that JADX was installed correctly
|
||||||
|
- name: Verify JADX installation
|
||||||
|
run: jadx --version
|
||||||
|
|
||||||
|
# Verify that JADX was installed correctly
|
||||||
|
- name: Extract app credentials
|
||||||
|
run: node . --target mobile --output ./credentials.mobile.json && node . --target tv --output ./credentials.tv.json
|
||||||
|
|
||||||
|
# Commit all changed files back to the repository
|
||||||
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
@@ -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
|
||||||
@@ -1,31 +1,34 @@
|
|||||||
# Crextractor
|
# 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
|
## 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
|
||||||
|
|
||||||
### Fetching already extracted secrets
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
async function main() {
|
import { pull } from 'crextractor';
|
||||||
const url = 'https://raw.githubusercontent.com/vitalygashkov/crextractor/refs/heads/main/credentials.tv.json';
|
|
||||||
const data = await fetch(url).then((response) => response.json());
|
|
||||||
|
|
||||||
// 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', {
|
const response = await fetch('https://beta-api.crunchyroll.com/auth/v1/token', {
|
||||||
headers: {
|
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)',
|
'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
|
```js
|
||||||
import { extract } from 'crextractor';
|
import { extract } from 'crextractor';
|
||||||
|
|
||||||
|
async function main() {
|
||||||
const { id, secret, encoded, authorization } = await extract();
|
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
|
```bash
|
||||||
npx crextractor --target mobile --output ./credentials.mobile.json
|
npx crextractor --target mobile --output ./credentials.mobile.json
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ const args = parseArgs({
|
|||||||
},
|
},
|
||||||
cleanup: {
|
cleanup: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Vendored
+17
-3
@@ -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>;
|
||||||
|
|||||||
+11
-9
@@ -1,16 +1,12 @@
|
|||||||
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 { download } = require('molnia');
|
|
||||||
const { existsSync } = require('node:fs');
|
const { existsSync } = require('node:fs');
|
||||||
|
const { download } = require('molnia');
|
||||||
|
|
||||||
const downloadMobileApk = 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();
|
|
||||||
const route = '/r2' + html.split('/r2')[1]?.split('"')[0];
|
|
||||||
const url = `https://apkcombo.com${route}`;
|
|
||||||
const filepath = join(process.cwd(), 'crunchyroll.xapk');
|
|
||||||
await download(url, {
|
await download(url, {
|
||||||
output: filepath,
|
output: filepath,
|
||||||
onError: (error) => console.error(error),
|
onError: (error) => console.error(error),
|
||||||
@@ -100,7 +96,7 @@ const parseVersion = async (decompiledDir) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const extract = async ({ target, output, cleanup = false } = {}) => {
|
const extract = async ({ target = 'mobile', output, cleanup = false } = {}) => {
|
||||||
console.log('Downloading APK...');
|
console.log('Downloading APK...');
|
||||||
const apkPath = target === 'tv' ? await downloadTvApk() : await downloadMobileApk();
|
const apkPath = target === 'tv' ? await downloadTvApk() : await downloadMobileApk();
|
||||||
|
|
||||||
@@ -132,4 +128,10 @@ const extract = async ({ target, output, cleanup = false } = {}) => {
|
|||||||
return { version, id, secret, encoded, authorization };
|
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
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "crextractor",
|
"name": "crextractor",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "crextractor",
|
"name": "crextractor",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "crextractor",
|
"name": "crextractor",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"description": "Utility for extracting credentials from the Crunchyroll Android app",
|
"description": "Utility for extracting credentials from the Crunchyroll Android app",
|
||||||
"main": "crextractor.js",
|
"main": "crextractor.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -15,6 +15,8 @@
|
|||||||
"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": [
|
||||||
|
|||||||
Reference in New Issue
Block a user