Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0b28835

Browse files
committedOct 24, 2022
fix rapidcloud
1 parent bd2aec8 commit 0b28835

File tree

9 files changed

+61
-44
lines changed

9 files changed

+61
-44
lines changed
 

‎dist/providers/anime/zoro.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/providers/anime/zoro.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/providers/meta/anilist.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/utils/extractors/rapidcloud.js

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/utils/extractors/rapidcloud.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@consumet/extensions",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"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.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

‎src/providers/anime/zoro.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ class Zoro extends AnimeParser {
9494
info.type = $('span.item').last().prev().prev().text().toUpperCase() as MediaFormat;
9595
info.url = `${this.baseUrl}/${id}`;
9696

97-
const subDub = $('div.film-stats span.item div.tick-dub').toArray().map((value) => $(value).text().toLowerCase())
97+
const subDub = $('div.film-stats span.item div.tick-dub')
98+
.toArray()
99+
.map(value => $(value).text().toLowerCase());
98100
if (subDub.length > 1) {
99-
info.subOrDub = SubOrSub.BOTH
101+
info.subOrDub = SubOrSub.BOTH;
100102
} else if (subDub.length > 0) {
101-
info.subOrDub = subDub[0] as SubOrSub
103+
info.subOrDub = subDub[0] as SubOrSub;
102104
} else {
103-
info.subOrDub = SubOrSub.SUB
105+
info.subOrDub = SubOrSub.SUB;
104106
}
105107

106108
const episodesAjax = await axios.get(`${this.baseUrl}/ajax/v2/episode/list/${id.split('-').pop()}`, {
@@ -115,7 +117,11 @@ class Zoro extends AnimeParser {
115117
info.totalEpisodes = $$('div.detail-infor-content > div > a').length;
116118
info.episodes = [];
117119
$$('div.detail-infor-content > div > a').each((i, el) => {
118-
const episodeId = $$(el).attr('href')?.split('/')[2]?.replace('?ep=', '$episode$')?.concat(`$${info.subOrDub}`)!;
120+
const episodeId = $$(el)
121+
.attr('href')
122+
?.split('/')[2]
123+
?.replace('?ep=', '$episode$')
124+
?.concat(`$${info.subOrDub}`)!;
119125
const number = parseInt($$(el).attr('data-number')!);
120126
const title = $$(el).attr('title');
121127
const url = this.baseUrl + $$(el).attr('href');
@@ -175,9 +181,11 @@ class Zoro extends AnimeParser {
175181
// Fallback to using sub if no info found in case of compatibility
176182

177183
// TODO: add both options later
178-
let subOrDub:'sub' | 'dub' = episodeId.split('$')?.pop() === 'dub' ? 'dub' : 'sub';
184+
let subOrDub: 'sub' | 'dub' = episodeId.split('$')?.pop() === 'dub' ? 'dub' : 'sub';
179185

180-
episodeId = `${this.baseUrl}/watch/${episodeId.replace('$episode$', '?ep=').replace(/\$auto|\$sub|\$dub/gi, '')}`;
186+
episodeId = `${this.baseUrl}/watch/${episodeId
187+
.replace('$episode$', '?ep=')
188+
.replace(/\$auto|\$sub|\$dub/gi, '')}`;
181189

182190
try {
183191
const { data } = await axios.get(
@@ -236,7 +244,7 @@ class Zoro extends AnimeParser {
236244
.map((i: any, el: any) => ($(el).attr('data-server-id') == `${index}` ? $(el) : null))
237245
.get()[0]
238246
.attr('data-id')!;
239-
}
247+
};
240248

241249
/**
242250
* @param page Page number

‎src/providers/meta/anilist.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import Gogoanime from '../../providers/anime/gogoanime';
3939
import Enime from '../anime/enime';
4040
import Zoro from '../anime/zoro';
4141
import Mangasee123 from '../manga/mangasee123';
42+
import Crunchyroll from '../anime/crunchyroll';
4243

4344
class Anilist extends AnimeParser {
4445
override readonly name = 'Anilist';
@@ -643,7 +644,10 @@ class Anilist extends AnimeParser {
643644
// Set the correct episode sub/dub request type
644645
possibleAnime.episodes.forEach((_: any, index: number) => {
645646
if (possibleAnime.subOrDub === SubOrSub.BOTH) {
646-
possibleAnime.episodes[index].id = possibleAnime.episodes[index].id.replace(`$both`, dub ? '$dub' : '$sub');
647+
possibleAnime.episodes[index].id = possibleAnime.episodes[index].id.replace(
648+
`$both`,
649+
dub ? '$dub' : '$sub'
650+
);
647651
}
648652
});
649653
}

‎src/utils/extractors/rapidcloud.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ class RapidCloud extends VideoExtractor {
2828

2929
let res = null;
3030

31-
let { data: sId } = await axios({
32-
method: 'GET',
33-
url: `${this.consumetApi}/utils/rapid-cloud`,
34-
validateStatus: status => true,
35-
});
36-
37-
if (!sId) {
38-
sId = await axios({
39-
method: 'GET',
40-
url: `${this.enimeApi}/tool/rapid-cloud/server-id`,
41-
validateStatus: status => true,
42-
});
43-
}
44-
45-
res = await axios.get(`${this.host}/ajax/embed-6/getSources?id=${id}&sId=${sId}`, options);
31+
// let { data: sId } = await axios({
32+
// method: 'GET',
33+
// url: `${this.consumetApi}/utils/rapid-cloud`,
34+
// validateStatus: status => true,
35+
// });
36+
37+
// if (!sId) {
38+
// sId = await axios({
39+
// method: 'GET',
40+
// url: `${this.enimeApi}/tool/rapid-cloud/server-id`,
41+
// validateStatus: status => true,
42+
// });
43+
// }
44+
45+
res = await axios.get(`${this.host}/ajax/embed-6/getSources?id=${id}`, options);
4646

4747
let {
4848
data: { sources, tracks, intro, encrypted },

0 commit comments

Comments
 (0)
Please sign in to comment.