Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rabbitfix #537

Merged
merged 5 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dist/extractors/rabbit.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const main: (xrax: any) => Promise<any>;
export { main };
545 changes: 545 additions & 0 deletions dist/extractors/rabbit.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/extractors/rabbit.js.map

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions dist/extractors/vidcloud.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { VideoExtractor, IVideo, ISubtitle } from '../models';
declare class VidCloud extends VideoExtractor {
protected serverName: string;
protected sources: IVideo[];
private readonly host;
private readonly host2;
extract: (videoUrl: URL, isAlternative?: boolean) => Promise<{
extract: (videoUrl: URL, _?: boolean) => Promise<{
sources: IVideo[];
} & {
subtitles: ISubtitle[];
Expand Down
22 changes: 5 additions & 17 deletions dist/extractors/vidcloud.js

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

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

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

2 changes: 1 addition & 1 deletion dist/providers/anime/zoro.js.map

Large diffs are not rendered by default.

601 changes: 601 additions & 0 deletions src/extractors/rabbit.ts

Large diffs are not rendered by default.

26 changes: 6 additions & 20 deletions src/extractors/vidcloud.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import CryptoJS from 'crypto-js';

import { main } from './rabbit'
import { VideoExtractor, IVideo, ISubtitle, Intro } from '../models';
import { USER_AGENT, isJson, substringAfter, substringBefore } from '../utils';
import { USER_AGENT } from '../utils';

class VidCloud extends VideoExtractor {
protected override serverName = 'VidCloud';
protected override sources: IVideo[] = [];

private readonly host = 'https://dokicloud.one';
private readonly host2 = 'https://rabbitstream.net';

override extract = async (
videoUrl: URL,
isAlternative: boolean = false
_?: boolean,

Check notice on line 12 in src/extractors/vidcloud.ts

View check run for this annotation

codefactor.io / CodeFactor

src/extractors/vidcloud.ts#L12

'_' is defined but never used. (@typescript-eslint/no-unused-vars)
): Promise<{ sources: IVideo[] } & { subtitles: ISubtitle[] }> => {
const result: { sources: IVideo[]; subtitles: ISubtitle[]; intro?: Intro } = {
sources: [],
Expand All @@ -27,20 +24,9 @@
'User-Agent': USER_AGENT,
},
};
let res = undefined;
let sources = undefined;

res = await this.client.get(
`${isAlternative ? this.host2 : this.host}/ajax/embed-4/getSources?id=${id}`,
options
);

if (!isJson(res.data.sources)) {
const keys = await (await this.client.get('https://raw.githubusercontent.com/eatmynerds/key/e4/key.txt')).data;
const keyString = btoa(String.fromCharCode.apply(null, Array.from(new Uint8Array(JSON.parse(JSON.stringify(keys))))));
const decryptedVal = CryptoJS.AES.decrypt(res.data.sources, keyString).toString(CryptoJS.enc.Utf8);
sources = isJson(decryptedVal) ? JSON.parse(decryptedVal) : res.data.sources;
}
const res = await main(id);
const sources = res.sources;

this.sources = sources.map((s: any) => ({
url: s.file,
Expand Down Expand Up @@ -80,7 +66,7 @@
quality: 'auto',
});

result.subtitles = res.data.tracks.map((s: any) => ({
result.subtitles = res.tracks.map((s: any) => ({

Check warning on line 69 in src/extractors/vidcloud.ts

View check run for this annotation

codefactor.io / CodeFactor

src/extractors/vidcloud.ts#L69

Unexpected any. Specify a different type. (@typescript-eslint/no-explicit-any)
url: s.file,
lang: s.label ? s.label : 'Default (maybe)',
}));
Expand Down
21 changes: 21 additions & 0 deletions test/movies/vidcloud.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { VidCloud } from '../../src/extractors';


async function main() {
console.log("test start");
let vidCloud = new VidCloud();

Check warning on line 6 in test/movies/vidcloud.test.ts

View check run for this annotation

codefactor.io / CodeFactor

test/movies/vidcloud.test.ts#L6

'vidCloud' is never reassigned. Use 'const' instead. (prefer-const)
console.log("vidCloud object created!");
let url = new URL("https://rabbitstream.net/v2/embed-4/x21Ne4cJOFWC?z=");

Check warning on line 8 in test/movies/vidcloud.test.ts

View check run for this annotation

codefactor.io / CodeFactor

test/movies/vidcloud.test.ts#L8

'url' is never reassigned. Use 'const' instead. (prefer-const)
console.log("url created!");
console.log("extract called!");
try {
let res = await vidCloud.extract(url);

Check warning on line 12 in test/movies/vidcloud.test.ts

View check run for this annotation

codefactor.io / CodeFactor

test/movies/vidcloud.test.ts#L12

'res' is never reassigned. Use 'const' instead. (prefer-const)
console.log("extract success!")
console.log(res);
} catch (error) {
console.log(error);
}
}

main();

Loading