Skip to content

Commit

Permalink
chore(settings): display crawlers subtitles lang next to each crawler
Browse files Browse the repository at this point in the history
  • Loading branch information
AXeL-dev committed Jul 16, 2022
1 parent bbf3148 commit 8591aa8
Show file tree
Hide file tree
Showing 47 changed files with 118 additions and 153 deletions.
11 changes: 10 additions & 1 deletion src/app/crawlers/abstract/base.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ export abstract class BaseCrawler {
protected _name: string;
protected _baseUrl: string;
protected _isActive: boolean;
protected _defaultSubtitles: string;
protected filters: FilterList = {};
protected cache: Cache = {
animeList: [],
latestEpisodes: [],
};

constructor(name: string, baseUrl: string) {
constructor(name: string, baseUrl: string, defaultSubtitles: string) {
this._name = name;
this._baseUrl = baseUrl;
this._isActive = true;
this._defaultSubtitles = defaultSubtitles;
this.filters = {
number: (text: string) => {
return toNumber(text);
Expand Down Expand Up @@ -60,6 +62,9 @@ export abstract class BaseCrawler {
const currentDate = now().getTime();
return date > currentDate ? currentDate : date;
},
subtitles: (text: string) => {
return defaultSubtitles;
},
};
}

Expand All @@ -71,6 +76,10 @@ export abstract class BaseCrawler {
return this._baseUrl;
}

get subtitles() {
return this._defaultSubtitles;
}

get isActive() {
return this._isActive;
}
Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vostar/addanime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Observable } from 'rxjs';

export class AddAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('AddAnime', 'https://ar.addanime.online');
super('AddAnime', 'https://ar.addanime.online', 'vostar');
this.filters = {
...this.filters,
title: (text: string) => {
Expand All @@ -21,9 +21,6 @@ export class AddAnimeCrawler extends LatestEpisodesCrawler {
const num = text.match(/(.*) (\d+)/);
return num?.length ? +num[2] : 1;
},
subtitles: (text: string) => {
return 'vostar';
},
};
}

Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vostar/anime4up.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import { Observable } from 'rxjs';

export class AnimeFourUpCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('Anime4up', 'https://w1.anime4up.com');
super('Anime4up', 'https://w1.anime4up.com', 'vostar');
this.filters = {
...this.filters,
number: (text: string) => {
const num = text.match(/(.*) (\d+)/);
return num?.length ? +num[2] : 1;
},
subtitles: (text: string) => {
return 'vostar';
},
};
}

Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vostar/arabanime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import { Observable } from 'rxjs';

export class ArabAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('ArabAnime', 'https://www.arabanime.net');
super('ArabAnime', 'https://www.arabanime.net', 'vostar');
this.filters = {
...this.filters,
number: (text: string) => {
const num = text.match(/(.*) (\d+)/);
return num?.length ? +num[2] : 1;
},
subtitles: (text: string) => {
return 'vostar';
},
};
}

Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vostar/egyanime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Observable } from 'rxjs';

export class EgyAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('EgyAnime', 'https://www.egyanime.com');
super('EgyAnime', 'https://www.egyanime.com', 'vostar');
this.filters = {
...this.filters,
cover: (text: string) => {
Expand All @@ -16,9 +16,6 @@ export class EgyAnimeCrawler extends LatestEpisodesCrawler {
const num = text.match(/(.*) (\d+)/);
return num?.length ? +num[2] : 1;
},
subtitles: (text: string) => {
return 'vostar';
},
};
}

Expand Down
8 changes: 1 addition & 7 deletions src/app/crawlers/vostar/okanime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ import { Observable } from 'rxjs';

export class OkanimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('OKanime', 'https://okanime.tv');
this.filters = {
...this.filters,
subtitles: (text: string) => {
return 'vostar';
},
};
super('OKanime', 'https://okanime.tv', 'vostar');
}

_getLatestEpisodes(): Observable<Episode[]> {
Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vostar/witanime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import { Observable } from 'rxjs';

export class WitAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('WitAnime', 'https://witanime.com');
super('WitAnime', 'https://witanime.com', 'vostar');
this.filters = {
...this.filters,
number: (text: string) => {
const num = text.match(/(.*) (\d+)/);
return num?.length ? +num[2] : 1;
},
subtitles: (text: string) => {
return 'vostar';
},
};
}

Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vostar/zimabdko.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class ZimabdkoCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('Zimabdko', 'https://www.zimabdko.com');
super('Zimabdko', 'https://www.zimabdko.com', 'vostar');
this.filters = {
...this.filters,
title: (text: string) => {
Expand All @@ -22,9 +22,6 @@ export class ZimabdkoCrawler extends LatestEpisodesCrawler {
.match(/(أنمي )?(.*) الحلقة (\d+)/);
return toNumber(num?.length ? num[3] : text.match(/\d+/g)?.[0]);
},
subtitles: (text: string) => {
return 'vostar';
},
};
}

Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vosten/4anime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class FourAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('4Anime', 'https://4anime.to');
super('4Anime', 'https://4anime.to', 'vosten');
this.filters = {
...this.filters,
cover: (text: string) => {
Expand All @@ -20,9 +20,6 @@ export class FourAnimeCrawler extends LatestEpisodesCrawler {
const num = text.match(/\d+/g);
return toNumber(num?.length ? num[0] : text);
},
subtitles: (text: string) => {
return 'vosten';
},
};
}

Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vosten/9anime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class NineAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('9Anime', 'https://9anime.id');
super('9Anime', 'https://9anime.id', 'vosten');
this.filters = {
...this.filters,
number: (text: string) => {
Expand All @@ -21,9 +21,6 @@ export class NineAnimeCrawler extends LatestEpisodesCrawler {
);
return `${this.filters.concatUrl(text)}/ep-${number}`;
},
subtitles: (text: string) => {
return 'vosten';
},
};
}

Expand Down
8 changes: 1 addition & 7 deletions src/app/crawlers/vosten/animefrenzy.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ import { Observable } from 'rxjs';

export class AnimeFrenzyCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('AnimeFrenzy', 'https://animefrenzy.net');
this.filters = {
...this.filters,
subtitles: (text: string) => {
return 'vosten';
},
};
super('AnimeFrenzy', 'https://animefrenzy.net', 'vosten');
}

_getLatestEpisodes(): Observable<Episode[]> {
Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vosten/animekisa.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class AnimeKisaCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('AnimeKisa', 'https://animekisa.tv');
super('AnimeKisa', 'https://animekisa.tv', 'vosten');
this.filters = {
...this.filters,
number: (text: string) => {
const num = text.match(/Episode (\d+)/);
return toNumber(num?.length ? num[1] : text);
},
subtitles: (text: string) => {
return 'vosten';
},
date: (text: string) => {
return +text * 1000; // convert to unix timestamp
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/crawlers/vosten/animension.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { map, Observable } from 'rxjs';

export class AnimensionCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('Animension', 'https://animension.to');
super('Animension', 'https://animension.to', 'vosten');
}

_getLatestEpisodes(): Observable<Episode[]> {
Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vosten/animixplay.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class AnimixPlayCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('AnimixPlay', 'https://animixplay.to');
super('AnimixPlay', 'https://animixplay.to', 'vosten');
this.filters = {
...this.filters,
number: (text: string) => {
const num = text.match(/EP (\d+)/);
return toNumber(num?.length ? num[1] : text);
},
subtitles: (text: string) => {
return 'vosten';
},
date: (text: string) => {
if (
text.indexOf('mins ago') !== -1 ||
Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vosten/darkanime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import { Observable } from 'rxjs';

export class DarkAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('DarkAnime', 'https://darkanime.stream');
super('DarkAnime', 'https://darkanime.stream', 'vosten');
this.filters = {
...this.filters,
number: (text: string) => {
return +text.replace('E', '');
},
subtitles: (text: string) => {
return 'vosten';
},
url: (text: string, element: any) => {
const number = this.scraper.htmlParser.find(
element,
Expand Down
2 changes: 1 addition & 1 deletion src/app/crawlers/vosten/gogoanime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class GogoAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('GogoAnime', 'https://gogoanime.gg');
super('GogoAnime', 'https://gogoanime.gg', 'vosten');
this.filters = {
...this.filters,
number: (text: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/crawlers/vosten/gogoanime2.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class GogoAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('GogoAnime', 'https://www11.gogoanimehub.com');
super('GogoAnime', 'https://www11.gogoanimehub.com', 'vosten');
this.filters = {
...this.filters,
number: (text: string) => {
Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vosten/gogoanimetv.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class GogoAnimeTvCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('GogoAnimeTv', 'https://gogoanimestv.org');
super('GogoAnimeTv', 'https://gogoanimestv.org', 'vosten');
this.filters = {
...this.filters,
title: (text: string) => {
Expand All @@ -17,9 +17,6 @@ export class GogoAnimeTvCrawler extends LatestEpisodesCrawler {
const num = text.match(/EP (\d+)/i);
return toNumber(num?.length ? num[1] : text);
},
subtitles: (text: string) => {
return 'vosten';
},
date: (text: string) => {
if (
text.indexOf('mins ago') !== -1 ||
Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vosten/gogoplay.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class GogoPlayCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('GogoPlay', 'https://gogoplay1.com');
super('GogoPlay', 'https://gogoplay1.com', 'vosten');
this.filters = {
...this.filters,
title: (text: string) => {
Expand All @@ -18,9 +18,6 @@ export class GogoPlayCrawler extends LatestEpisodesCrawler {
const num = text.match(/Episode (\d+)/);
return toNumber(num?.length ? num[1] : text);
},
subtitles: (text: string) => {
return 'vosten';
},
date: (text: string) => {
if (
text.indexOf('mins ago') !== -1 ||
Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vosten/yugenanime.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { toNumber } from 'src/app/helpers/number.helper';

export class YugenAnimeCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('YugenAnime', 'https://yugen.to');
super('YugenAnime', 'https://yugen.to', 'vosten');
this.filters = {
...this.filters,
cover: (text: string) => {
Expand All @@ -17,9 +17,6 @@ export class YugenAnimeCrawler extends LatestEpisodesCrawler {
const num = text.trim().match(/(\d+) (?:.*)$/i);
return toNumber(num?.length ? num[1] : text);
},
subtitles: (text: string) => {
return 'vosten';
},
};
}

Expand Down
5 changes: 1 addition & 4 deletions src/app/crawlers/vostfr/11anim.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Observable } from 'rxjs';

export class ElevenAnimCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('11Anim', 'https://11anim.net');
super('11Anim', 'https://11anim.net', 'vostfr');
this.filters = {
...this.filters,
title: (text: string) => {
Expand All @@ -19,9 +19,6 @@ export class ElevenAnimCrawler extends LatestEpisodesCrawler {
const num = text.replace('VOSTFR', '').match(/(.*) Episode (\d+)/i);
return num?.length ? +num[2] : 1;
},
subtitles: (text: string) => {
return 'vostfr';
},
date: (text: string) => {
let date = text.replace('Ajouté le ', '').toLowerCase();
date = date.replace(
Expand Down
2 changes: 1 addition & 1 deletion src/app/crawlers/vostfr/anime-max.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Observable } from 'rxjs';

export class AnimeMaxCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('AnimeMax', 'https://anime-max.co');
super('AnimeMax', 'https://anime-max.co', 'vostfr');
this.filters = {
...this.filters,
title: (text: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/crawlers/vostfr/animecomplet.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { frenchMonths } from 'src/app/helpers/date.helper';

export class AnimeCompletCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('AnimeComplet', 'https://animecomplet.me');
super('AnimeComplet', 'https://animecomplet.me', 'vostfr');
this.filters = {
...this.filters,
title: (text: string) => {
Expand Down
Loading

0 comments on commit 8591aa8

Please sign in to comment.