Skip to content

Commit

Permalink
flixhq hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
riimuru committed Oct 5, 2022
1 parent 59e4df0 commit 92831a2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 24 deletions.
1 change: 1 addition & 0 deletions dist/utils/extractors/vidcloud.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ declare class VidCloud extends VideoExtractor {
subtitles: ISubtitle[];
}>;
private wss;
private isJson;
}
export default VidCloud;
29 changes: 18 additions & 11 deletions dist/utils/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/utils/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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@consumet/extensions",
"version": "1.1.4",
"version": "1.1.5",
"description": "Nodejs library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
34 changes: 23 additions & 11 deletions src/utils/extractors/vidcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@ class VidCloud extends VideoExtractor {
'User-Agent': USER_AGENT,
},
};
//let res = null;
let res = undefined;
let sources = undefined;

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

const res = await this.wss(id!);
//const res = await this.wss(id!);

// const { data: key } = await axios.get(
// 'https://raw.githubusercontent.com/consumet/rapidclown/rabbitstream/key.txt'
// );
if (!this.isJson(res.data.sources)) {
const { data: key } = await axios.get(
'https://raw.githubusercontent.com/consumet/rapidclown/rabbitstream/key.txt'
);

const sources = JSON.parse(CryptoJS.AES.decrypt(res.sources, res.sid).toString(CryptoJS.enc.Utf8));
sources = JSON.parse(CryptoJS.AES.decrypt(res.data.sources, key).toString(CryptoJS.enc.Utf8));
}

this.sources = sources.map((s: any) => ({
url: s.file,
Expand Down Expand Up @@ -82,7 +85,7 @@ class VidCloud extends VideoExtractor {
quality: 'auto',
});

result.subtitles = res.tracks.map((s: any) => ({
result.subtitles = res.data.tracks.map((s: any) => ({
url: s.file,
lang: s.label ? s.label : 'Default (maybe)',
}));
Expand Down Expand Up @@ -115,6 +118,15 @@ class VidCloud extends VideoExtractor {
};
});
};

private isJson = (str: string) => {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
};
}

export default VidCloud;

0 comments on commit 92831a2

Please sign in to comment.