Skip to content

Commit

Permalink
Fixed rabbitstream keys (consumet#464)
Browse files Browse the repository at this point in the history
* Update vidcloud.ts

* Update rapidcloud.ts

* Updated key extractor

* changed key

* Removed logging

* [CodeFactor] Apply fixes

---------

Co-authored-by: codefactor-io <support@codefactor.io>
Co-authored-by: Marouane <57333995+riimuru@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 15, 2024
1 parent b69d04c commit beb68e6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 50 deletions.
8 changes: 5 additions & 3 deletions dist/extractors/rapidcloud.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 4 additions & 20 deletions dist/extractors/vidcloud.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dist/extractors/vidcloud.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/extractors/rapidcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class RapidCloud extends VideoExtractor {
} = res;

let decryptKey = await (
await this.client.get('https://raw.githubusercontent.com/theonlymo/keys/e1/key')
await this.client.get('https://raw.githubusercontent.com/cinemaxhq/keys/e1/key')
).data;

decryptKey = substringBefore(
Expand All @@ -45,7 +45,7 @@ class RapidCloud extends VideoExtractor {

if (!decryptKey) {
decryptKey = await (
await this.client.get('https://raw.githubusercontent.com/theonlymo/keys/e1/key')
await this.client.get('https://raw.githubusercontent.com/cinemaxhq/keys/e1/key')
).data;
}

Expand Down
29 changes: 5 additions & 24 deletions src/extractors/vidcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,14 @@ class VidCloud extends VideoExtractor {
);

if (!isJson(res.data.sources)) {
let { data: key } = await this.client.get('https://raw.githubusercontent.com/theonlymo/keys/e4/key');
const keys = await (await this.client.get('https://keys4.fun')).data["rabbitstream"]["keys"];
const keyString = btoa(String.fromCharCode.apply(null, Array.from(new Uint8Array(keys))));
const decryptedVal = CryptoJS.AES.decrypt(res.data.sources, keyString).toString(CryptoJS.enc.Utf8);
sources = JSON.parse(CryptoJS.AES.decrypt(res.data.sources, keyString).toString(CryptoJS.enc.Utf8));

key = substringBefore(substringAfter(key, '"blob-code blob-code-inner js-file-line">'), '</td>');

if (!key) {
key = await (await this.client.get('https://raw.githubusercontent.com/theonlymo/keys/e4/key')).data;
}

const sourcesArray = res.data.sources.split('');
let extractedKey = '';

let currentIndex = 0;
for (const index of key) {
const start = index[0] + currentIndex;
const end = start + index[1];
for (let i = start; i < end; i++) {
extractedKey += res.data.sources[i];
sourcesArray[i] = '';
}
currentIndex += index[1];
}

key = extractedKey;
res.data.sources = sourcesArray.join('');

const decryptedVal = CryptoJS.AES.decrypt(res.data.sources, key).toString(CryptoJS.enc.Utf8);
sources = isJson(decryptedVal) ? JSON.parse(decryptedVal) : res.data.sources;

}

this.sources = sources.map((s: any) => ({
Expand Down

0 comments on commit beb68e6

Please sign in to comment.