From 8591aa8786833000c1bf30d5763a8e0edf83d530 Mon Sep 17 00:00:00 2001 From: AXeL-dev Date: Sat, 16 Jul 2022 02:27:46 +0100 Subject: [PATCH] chore(settings): display crawlers subtitles lang next to each crawler --- src/app/crawlers/abstract/base.crawler.ts | 11 +++++++- src/app/crawlers/vostar/addanime.crawler.ts | 5 +--- src/app/crawlers/vostar/anime4up.crawler.ts | 5 +--- src/app/crawlers/vostar/arabanime.crawler.ts | 5 +--- src/app/crawlers/vostar/egyanime.crawler.ts | 5 +--- src/app/crawlers/vostar/okanime.crawler.ts | 8 +----- src/app/crawlers/vostar/witanime.crawler.ts | 5 +--- src/app/crawlers/vostar/zimabdko.crawler.ts | 5 +--- src/app/crawlers/vosten/4anime.crawler.ts | 5 +--- src/app/crawlers/vosten/9anime.crawler.ts | 5 +--- .../crawlers/vosten/animefrenzy.crawler.ts | 8 +----- src/app/crawlers/vosten/animekisa.crawler.ts | 5 +--- src/app/crawlers/vosten/animension.crawler.ts | 2 +- src/app/crawlers/vosten/animixplay.crawler.ts | 5 +--- src/app/crawlers/vosten/darkanime.crawler.ts | 5 +--- src/app/crawlers/vosten/gogoanime.crawler.ts | 2 +- src/app/crawlers/vosten/gogoanime2.crawler.ts | 2 +- .../crawlers/vosten/gogoanimetv.crawler.ts | 5 +--- src/app/crawlers/vosten/gogoplay.crawler.ts | 5 +--- src/app/crawlers/vosten/yugenanime.crawler.ts | 5 +--- src/app/crawlers/vostfr/11anim.crawler.ts | 5 +--- src/app/crawlers/vostfr/anime-max.crawler.ts | 2 +- .../crawlers/vostfr/animecomplet.crawler.ts | 2 +- src/app/crawlers/vostfr/animeko.crawler.ts | 5 +--- .../vostfr/animeresistance.crawler.ts | 5 +--- .../crawlers/vostfr/fullanimevf.crawler.ts | 5 +--- src/app/crawlers/vostfr/japmanga.crawler.ts | 5 +--- src/app/crawlers/vostfr/jetanimes.crawler.ts | 2 +- .../crawlers/vostfr/mangas-vostfr.crawler.ts | 5 +--- src/app/crawlers/vostfr/mavanimes.crawler.ts | 5 +--- src/app/crawlers/vostfr/neko-sama.crawler.ts | 2 +- src/app/crawlers/vostfr/neko-sama2.crawler.ts | 5 +--- src/app/crawlers/vostfr/otakufr.crawler.ts | 2 +- src/app/crawlers/vostfr/toonanime.crawler.ts | 2 +- src/app/crawlers/vostfr/voiranime.crawler.ts | 5 +--- .../crawlers/vostfr/voiranimeorg.crawler.ts | 2 +- src/app/crawlers/vostfr/vostanimez.crawler.ts | 2 +- src/app/crawlers/vostfr/vostfree.crawler.ts | 2 +- src/app/crawlers/vostfr/wacvostfr.crawler.ts | 2 +- src/app/crawlers/vostfr/wawanimes.crawler.ts | 2 +- src/app/helpers/lang.helper.ts | 6 +++++ .../link-list/link-list.component.scss | 27 ++----------------- .../episode/link-list/link-list.component.ts | 8 ++---- .../settings/crawlers/crawlers.component.html | 10 ++++++- .../settings/crawlers/crawlers.component.scss | 21 +++++++++++++++ .../settings/crawlers/crawlers.component.ts | 2 ++ src/app/modules/shared/css/badge-colors.scss | 27 +++++++++++++++++++ 47 files changed, 118 insertions(+), 153 deletions(-) create mode 100644 src/app/helpers/lang.helper.ts create mode 100644 src/app/modules/shared/css/badge-colors.scss diff --git a/src/app/crawlers/abstract/base.crawler.ts b/src/app/crawlers/abstract/base.crawler.ts index d01fdd6..6352b90 100644 --- a/src/app/crawlers/abstract/base.crawler.ts +++ b/src/app/crawlers/abstract/base.crawler.ts @@ -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); @@ -60,6 +62,9 @@ export abstract class BaseCrawler { const currentDate = now().getTime(); return date > currentDate ? currentDate : date; }, + subtitles: (text: string) => { + return defaultSubtitles; + }, }; } @@ -71,6 +76,10 @@ export abstract class BaseCrawler { return this._baseUrl; } + get subtitles() { + return this._defaultSubtitles; + } + get isActive() { return this._isActive; } diff --git a/src/app/crawlers/vostar/addanime.crawler.ts b/src/app/crawlers/vostar/addanime.crawler.ts index ad5f0e2..35c5a31 100644 --- a/src/app/crawlers/vostar/addanime.crawler.ts +++ b/src/app/crawlers/vostar/addanime.crawler.ts @@ -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) => { @@ -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'; - }, }; } diff --git a/src/app/crawlers/vostar/anime4up.crawler.ts b/src/app/crawlers/vostar/anime4up.crawler.ts index a098c10..40f778e 100644 --- a/src/app/crawlers/vostar/anime4up.crawler.ts +++ b/src/app/crawlers/vostar/anime4up.crawler.ts @@ -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'; - }, }; } diff --git a/src/app/crawlers/vostar/arabanime.crawler.ts b/src/app/crawlers/vostar/arabanime.crawler.ts index ef77348..9f1a17d 100644 --- a/src/app/crawlers/vostar/arabanime.crawler.ts +++ b/src/app/crawlers/vostar/arabanime.crawler.ts @@ -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'; - }, }; } diff --git a/src/app/crawlers/vostar/egyanime.crawler.ts b/src/app/crawlers/vostar/egyanime.crawler.ts index 017aa3e..08bfa0e 100644 --- a/src/app/crawlers/vostar/egyanime.crawler.ts +++ b/src/app/crawlers/vostar/egyanime.crawler.ts @@ -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) => { @@ -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'; - }, }; } diff --git a/src/app/crawlers/vostar/okanime.crawler.ts b/src/app/crawlers/vostar/okanime.crawler.ts index 6c72f2a..b09d4f6 100644 --- a/src/app/crawlers/vostar/okanime.crawler.ts +++ b/src/app/crawlers/vostar/okanime.crawler.ts @@ -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 { diff --git a/src/app/crawlers/vostar/witanime.crawler.ts b/src/app/crawlers/vostar/witanime.crawler.ts index d6ebf32..4db91b0 100644 --- a/src/app/crawlers/vostar/witanime.crawler.ts +++ b/src/app/crawlers/vostar/witanime.crawler.ts @@ -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'; - }, }; } diff --git a/src/app/crawlers/vostar/zimabdko.crawler.ts b/src/app/crawlers/vostar/zimabdko.crawler.ts index 94f3eff..cd58922 100644 --- a/src/app/crawlers/vostar/zimabdko.crawler.ts +++ b/src/app/crawlers/vostar/zimabdko.crawler.ts @@ -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) => { @@ -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'; - }, }; } diff --git a/src/app/crawlers/vosten/4anime.crawler.ts b/src/app/crawlers/vosten/4anime.crawler.ts index 72fe654..12f655c 100644 --- a/src/app/crawlers/vosten/4anime.crawler.ts +++ b/src/app/crawlers/vosten/4anime.crawler.ts @@ -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) => { @@ -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'; - }, }; } diff --git a/src/app/crawlers/vosten/9anime.crawler.ts b/src/app/crawlers/vosten/9anime.crawler.ts index 43e063d..7660215 100644 --- a/src/app/crawlers/vosten/9anime.crawler.ts +++ b/src/app/crawlers/vosten/9anime.crawler.ts @@ -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) => { @@ -21,9 +21,6 @@ export class NineAnimeCrawler extends LatestEpisodesCrawler { ); return `${this.filters.concatUrl(text)}/ep-${number}`; }, - subtitles: (text: string) => { - return 'vosten'; - }, }; } diff --git a/src/app/crawlers/vosten/animefrenzy.crawler.ts b/src/app/crawlers/vosten/animefrenzy.crawler.ts index 5cd0bfa..f04f952 100644 --- a/src/app/crawlers/vosten/animefrenzy.crawler.ts +++ b/src/app/crawlers/vosten/animefrenzy.crawler.ts @@ -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 { diff --git a/src/app/crawlers/vosten/animekisa.crawler.ts b/src/app/crawlers/vosten/animekisa.crawler.ts index fb3ce8e..12fe687 100644 --- a/src/app/crawlers/vosten/animekisa.crawler.ts +++ b/src/app/crawlers/vosten/animekisa.crawler.ts @@ -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 }, diff --git a/src/app/crawlers/vosten/animension.crawler.ts b/src/app/crawlers/vosten/animension.crawler.ts index 53f1870..2819dcf 100644 --- a/src/app/crawlers/vosten/animension.crawler.ts +++ b/src/app/crawlers/vosten/animension.crawler.ts @@ -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 { diff --git a/src/app/crawlers/vosten/animixplay.crawler.ts b/src/app/crawlers/vosten/animixplay.crawler.ts index 97b186c..c749cd9 100644 --- a/src/app/crawlers/vosten/animixplay.crawler.ts +++ b/src/app/crawlers/vosten/animixplay.crawler.ts @@ -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 || diff --git a/src/app/crawlers/vosten/darkanime.crawler.ts b/src/app/crawlers/vosten/darkanime.crawler.ts index c14c076..6cbb80b 100644 --- a/src/app/crawlers/vosten/darkanime.crawler.ts +++ b/src/app/crawlers/vosten/darkanime.crawler.ts @@ -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, diff --git a/src/app/crawlers/vosten/gogoanime.crawler.ts b/src/app/crawlers/vosten/gogoanime.crawler.ts index 595a002..420f88d 100644 --- a/src/app/crawlers/vosten/gogoanime.crawler.ts +++ b/src/app/crawlers/vosten/gogoanime.crawler.ts @@ -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) => { diff --git a/src/app/crawlers/vosten/gogoanime2.crawler.ts b/src/app/crawlers/vosten/gogoanime2.crawler.ts index 6e016a4..dcb10a2 100644 --- a/src/app/crawlers/vosten/gogoanime2.crawler.ts +++ b/src/app/crawlers/vosten/gogoanime2.crawler.ts @@ -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) => { diff --git a/src/app/crawlers/vosten/gogoanimetv.crawler.ts b/src/app/crawlers/vosten/gogoanimetv.crawler.ts index f0161b4..c4b3f4d 100644 --- a/src/app/crawlers/vosten/gogoanimetv.crawler.ts +++ b/src/app/crawlers/vosten/gogoanimetv.crawler.ts @@ -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) => { @@ -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 || diff --git a/src/app/crawlers/vosten/gogoplay.crawler.ts b/src/app/crawlers/vosten/gogoplay.crawler.ts index 6689578..583e29e 100644 --- a/src/app/crawlers/vosten/gogoplay.crawler.ts +++ b/src/app/crawlers/vosten/gogoplay.crawler.ts @@ -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) => { @@ -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 || diff --git a/src/app/crawlers/vosten/yugenanime.crawler.ts b/src/app/crawlers/vosten/yugenanime.crawler.ts index 64c9ebe..a03d7c9 100644 --- a/src/app/crawlers/vosten/yugenanime.crawler.ts +++ b/src/app/crawlers/vosten/yugenanime.crawler.ts @@ -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) => { @@ -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'; - }, }; } diff --git a/src/app/crawlers/vostfr/11anim.crawler.ts b/src/app/crawlers/vostfr/11anim.crawler.ts index 3b6c880..2a425a7 100644 --- a/src/app/crawlers/vostfr/11anim.crawler.ts +++ b/src/app/crawlers/vostfr/11anim.crawler.ts @@ -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) => { @@ -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( diff --git a/src/app/crawlers/vostfr/anime-max.crawler.ts b/src/app/crawlers/vostfr/anime-max.crawler.ts index d082284..6d48472 100644 --- a/src/app/crawlers/vostfr/anime-max.crawler.ts +++ b/src/app/crawlers/vostfr/anime-max.crawler.ts @@ -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) => { diff --git a/src/app/crawlers/vostfr/animecomplet.crawler.ts b/src/app/crawlers/vostfr/animecomplet.crawler.ts index 8a4b1bf..29edc33 100644 --- a/src/app/crawlers/vostfr/animecomplet.crawler.ts +++ b/src/app/crawlers/vostfr/animecomplet.crawler.ts @@ -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) => { diff --git a/src/app/crawlers/vostfr/animeko.crawler.ts b/src/app/crawlers/vostfr/animeko.crawler.ts index 1dcbe4e..30c192e 100644 --- a/src/app/crawlers/vostfr/animeko.crawler.ts +++ b/src/app/crawlers/vostfr/animeko.crawler.ts @@ -11,16 +11,13 @@ import { Observable } from 'rxjs'; export class AnimeKoCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('AnimeKo', 'https://animeko.co'); + super('AnimeKo', 'https://animeko.co', 'vostfr'); this.filters = { ...this.filters, cover: (text: string) => { const cover = text.replace('/small', ''); return this.filters.concatUrl(cover); }, - subtitles: (text: string) => { - return 'vostfr'; - }, date: (text: string) => { let date = text.toLowerCase(); if (date.indexOf("aujourd'hui") !== -1) { diff --git a/src/app/crawlers/vostfr/animeresistance.crawler.ts b/src/app/crawlers/vostfr/animeresistance.crawler.ts index d74401e..f33dc21 100644 --- a/src/app/crawlers/vostfr/animeresistance.crawler.ts +++ b/src/app/crawlers/vostfr/animeresistance.crawler.ts @@ -7,16 +7,13 @@ import { toNumber } from 'src/app/helpers/number.helper'; export class AnimeResistanceCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('AnimeResistance', 'https://animeresistance.co'); + super('AnimeResistance', 'https://animeresistance.co', 'vostfr'); this.filters = { ...this.filters, number: (text: string) => { const num = text.match(/EP. (\d+)/); return toNumber(num?.length ? num[1] : text); }, - subtitles: (text: string) => { - return 'vostfr'; - }, date: (text: string) => { if (text.indexOf('minute') !== -1 || text.indexOf('heure') !== -1) { return today(); diff --git a/src/app/crawlers/vostfr/fullanimevf.crawler.ts b/src/app/crawlers/vostfr/fullanimevf.crawler.ts index de4c657..8c4c12a 100644 --- a/src/app/crawlers/vostfr/fullanimevf.crawler.ts +++ b/src/app/crawlers/vostfr/fullanimevf.crawler.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs'; export class FullAnimeVFCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('FullAnimeVF', 'https://www.fullanimefr.com'); + super('FullAnimeVF', 'https://www.fullanimefr.com', 'vostfr'); this.filters = { ...this.filters, cover: (text: string) => { @@ -32,9 +32,6 @@ export class FullAnimeVFCrawler extends LatestEpisodesCrawler { .replace('VOSTFR', '') .replace(/(.*) Episode (\d+)/, '$1'); }, - subtitles: (text: string) => { - return 'vostfr'; - }, }; } diff --git a/src/app/crawlers/vostfr/japmanga.crawler.ts b/src/app/crawlers/vostfr/japmanga.crawler.ts index dce1003..030604c 100644 --- a/src/app/crawlers/vostfr/japmanga.crawler.ts +++ b/src/app/crawlers/vostfr/japmanga.crawler.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs'; export class JapMangaCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('JapManga', 'https://www.japmanga.com'); + super('JapManga', 'https://www.japmanga.com', 'vostfr'); this.filters = { ...this.filters, number: (text: string) => { @@ -18,9 +18,6 @@ export class JapMangaCrawler extends LatestEpisodesCrawler { .replace(/(.*) (\d+)/, '$1') .trim(); }, - subtitles: (text: string) => { - return 'vostfr'; - }, }; } diff --git a/src/app/crawlers/vostfr/jetanimes.crawler.ts b/src/app/crawlers/vostfr/jetanimes.crawler.ts index ecfee32..71d913a 100644 --- a/src/app/crawlers/vostfr/jetanimes.crawler.ts +++ b/src/app/crawlers/vostfr/jetanimes.crawler.ts @@ -6,7 +6,7 @@ import { now } from 'src/app/helpers/date.helper'; export class JetAnimesCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('JetAnimes', 'https://www.jetanimes.com'); + super('JetAnimes', 'https://www.jetanimes.com', 'vostfr'); const dateFilter = this.filters.date; this.filters = { ...this.filters, diff --git a/src/app/crawlers/vostfr/mangas-vostfr.crawler.ts b/src/app/crawlers/vostfr/mangas-vostfr.crawler.ts index 044bd3d..0e264f3 100644 --- a/src/app/crawlers/vostfr/mangas-vostfr.crawler.ts +++ b/src/app/crawlers/vostfr/mangas-vostfr.crawler.ts @@ -6,7 +6,7 @@ import { frenchMonths } from '../../helpers/date.helper'; export class MangasVostfrCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('Mangas-vostfr', 'https://mangas-vostfr.com'); + super('Mangas-vostfr', 'https://mangas-vostfr.com', 'vostfr'); this.filters = { ...this.filters, number: (text: string) => { @@ -19,9 +19,6 @@ export class MangasVostfrCrawler extends LatestEpisodesCrawler { .replace(/(.*) (\d+)/, '$1') .trim(); }, - subtitles: (text: string) => { - return 'vostfr'; - }, date: (text: string) => { let date = text.toLowerCase(); date = date diff --git a/src/app/crawlers/vostfr/mavanimes.crawler.ts b/src/app/crawlers/vostfr/mavanimes.crawler.ts index 5d12108..f8848f9 100644 --- a/src/app/crawlers/vostfr/mavanimes.crawler.ts +++ b/src/app/crawlers/vostfr/mavanimes.crawler.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs'; export class MavAnimesCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('MavAnimes', 'http://www.mavanimes.co'); + super('MavAnimes', 'http://www.mavanimes.co', 'vostfr'); this.filters = { ...this.filters, cover: (text: string) => { @@ -25,9 +25,6 @@ export class MavAnimesCrawler extends LatestEpisodesCrawler { .replace(/(.*) (\d+)/, '$1') .replace(/ – $/, ''); }, - subtitles: (text: string) => { - return 'vostfr'; - }, }; } diff --git a/src/app/crawlers/vostfr/neko-sama.crawler.ts b/src/app/crawlers/vostfr/neko-sama.crawler.ts index ba151e4..2027ea9 100644 --- a/src/app/crawlers/vostfr/neko-sama.crawler.ts +++ b/src/app/crawlers/vostfr/neko-sama.crawler.ts @@ -8,7 +8,7 @@ import { toNumber } from 'src/app/helpers/number.helper'; export class NekoSamaCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('Neko-sama', 'https://www.neko-sama.fr'); + super('Neko-sama', 'https://www.neko-sama.fr', 'vostfr'); this.filters = { ...this.filters, number: (text: string) => { diff --git a/src/app/crawlers/vostfr/neko-sama2.crawler.ts b/src/app/crawlers/vostfr/neko-sama2.crawler.ts index f069e61..a98896d 100644 --- a/src/app/crawlers/vostfr/neko-sama2.crawler.ts +++ b/src/app/crawlers/vostfr/neko-sama2.crawler.ts @@ -7,16 +7,13 @@ import { toNumber } from 'src/app/helpers/number.helper'; export class NekoSamaCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('Neko-sama', 'https://www.neko-sama.fr'); + super('Neko-sama', 'https://www.neko-sama.fr', 'vostfr'); this.filters = { ...this.filters, number: (text: string) => { const num = text.match(/Ep. (\d+)/); return toNumber(num?.length ? num[1] : text); }, - subtitles: (text: string) => { - return 'vostfr'; - }, date: (text: string) => { if (text.indexOf('minute') !== -1 || text.indexOf('heure') !== -1) { return today(); diff --git a/src/app/crawlers/vostfr/otakufr.crawler.ts b/src/app/crawlers/vostfr/otakufr.crawler.ts index e834732..4600446 100644 --- a/src/app/crawlers/vostfr/otakufr.crawler.ts +++ b/src/app/crawlers/vostfr/otakufr.crawler.ts @@ -7,7 +7,7 @@ import { toNumber } from 'src/app/helpers/number.helper'; export class OtakuFrCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('OtakuFr', 'https://otakufr.co'); + super('OtakuFr', 'https://otakufr.co', 'vostfr'); this.filters = { ...this.filters, title: (text: string) => { diff --git a/src/app/crawlers/vostfr/toonanime.crawler.ts b/src/app/crawlers/vostfr/toonanime.crawler.ts index 46a73f0..51a2353 100644 --- a/src/app/crawlers/vostfr/toonanime.crawler.ts +++ b/src/app/crawlers/vostfr/toonanime.crawler.ts @@ -6,7 +6,7 @@ import { toNumber } from 'src/app/helpers/number.helper'; export class ToonAnimeCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('ToonAnime', 'https://wvvw.toonanime.tv'); + super('ToonAnime', 'https://wvvw.toonanime.tv', 'vostfr'); this.filters = { ...this.filters, title: (text: string) => { diff --git a/src/app/crawlers/vostfr/voiranime.crawler.ts b/src/app/crawlers/vostfr/voiranime.crawler.ts index 8653da5..425e6ae 100644 --- a/src/app/crawlers/vostfr/voiranime.crawler.ts +++ b/src/app/crawlers/vostfr/voiranime.crawler.ts @@ -6,15 +6,12 @@ import { Observable } from 'rxjs'; export class VoirAnimeCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('VoirAnime', 'https://voiranime.com'); + super('VoirAnime', 'https://voiranime.com', 'vostfr'); this.filters = { ...this.filters, cover: (text: string) => { return text.replace('-110x150', ''); }, - subtitles: (text: string) => { - return 'vostfr'; - }, date: (text: string) => { if ( text.indexOf('mins ago') !== -1 || diff --git a/src/app/crawlers/vostfr/voiranimeorg.crawler.ts b/src/app/crawlers/vostfr/voiranimeorg.crawler.ts index 7d27248..ebdcf39 100644 --- a/src/app/crawlers/vostfr/voiranimeorg.crawler.ts +++ b/src/app/crawlers/vostfr/voiranimeorg.crawler.ts @@ -6,7 +6,7 @@ import { toNumber } from 'src/app/helpers/number.helper'; export class VoirAnimeOrgCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('VoirAnime.org', 'https://voiranime.org'); + super('VoirAnime.org', 'https://voiranime.org', 'vostfr'); this.filters = { ...this.filters, title: (text: string) => { diff --git a/src/app/crawlers/vostfr/vostanimez.crawler.ts b/src/app/crawlers/vostfr/vostanimez.crawler.ts index c7a90bb..57fcafc 100644 --- a/src/app/crawlers/vostfr/vostanimez.crawler.ts +++ b/src/app/crawlers/vostfr/vostanimez.crawler.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs'; export class VostAnimezCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('VostAnimez', 'https://vostanimez.com'); + super('VostAnimez', 'https://vostanimez.com', 'vostfr'); this.filters = { ...this.filters, title: (text: string) => { diff --git a/src/app/crawlers/vostfr/vostfree.crawler.ts b/src/app/crawlers/vostfr/vostfree.crawler.ts index 9cbf798..39de537 100644 --- a/src/app/crawlers/vostfr/vostfree.crawler.ts +++ b/src/app/crawlers/vostfr/vostfree.crawler.ts @@ -6,7 +6,7 @@ import { Observable } from 'rxjs'; export class VostFreeCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('VostFree', 'https://vostfree.com'); + super('VostFree', 'https://vostfree.com', 'vostfr'); this.filters = { ...this.filters, title: (text: string) => { diff --git a/src/app/crawlers/vostfr/wacvostfr.crawler.ts b/src/app/crawlers/vostfr/wacvostfr.crawler.ts index 8a8415e..d8afbc9 100644 --- a/src/app/crawlers/vostfr/wacvostfr.crawler.ts +++ b/src/app/crawlers/vostfr/wacvostfr.crawler.ts @@ -7,7 +7,7 @@ import { toNumber } from 'src/app/helpers/number.helper'; export class WacVostfrCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('WacVostfr', 'https://wacvostfr.com'); + super('WacVostfr', 'https://wacvostfr.com', 'vostfr'); this.filters = { ...this.filters, title: (text: string) => { diff --git a/src/app/crawlers/vostfr/wawanimes.crawler.ts b/src/app/crawlers/vostfr/wawanimes.crawler.ts index acfcd5f..802e4c6 100644 --- a/src/app/crawlers/vostfr/wawanimes.crawler.ts +++ b/src/app/crawlers/vostfr/wawanimes.crawler.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs'; export class WawAnimesCrawler extends LatestEpisodesCrawler { constructor(private scraper: ScraperService) { - super('WawAnimes', 'https://wawanimes.tv'); + super('WawAnimes', 'https://wawanimes.tv', 'vostfr'); this.filters = { ...this.filters, title: (text: string) => { diff --git a/src/app/helpers/lang.helper.ts b/src/app/helpers/lang.helper.ts new file mode 100644 index 0000000..2a6433a --- /dev/null +++ b/src/app/helpers/lang.helper.ts @@ -0,0 +1,6 @@ +export const allLangColors: { [key: string]: string } = { + vostfr: 'blue', + vostar: 'yellow', + vosten: 'dark', + vf: 'green', +}; diff --git a/src/app/modules/episode/link-list/link-list.component.scss b/src/app/modules/episode/link-list/link-list.component.scss index 62a5e95..10968d2 100644 --- a/src/app/modules/episode/link-list/link-list.component.scss +++ b/src/app/modules/episode/link-list/link-list.component.scss @@ -1,3 +1,5 @@ +@import "../../shared/css/badge-colors.scss"; + [mdcList] { padding: 12px 0; } @@ -13,31 +15,6 @@ border-radius: 2px; min-width: 90px; text-align: center; - &.blue { - background: #0061aa; - } - &.dark { - background: #34393f; - } - &.pink { - background: #b83280; - } - &.green { - background: #38a169; - } - &.red { - background: #c53030; - } - &.purple { - background: #6b46c1; - } - &.orange { - background: #c05621; - } - &.yellow { - background: #fec107; - color: #1b0e00; - } } .link { diff --git a/src/app/modules/episode/link-list/link-list.component.ts b/src/app/modules/episode/link-list/link-list.component.ts index ba0e6f0..e937848 100644 --- a/src/app/modules/episode/link-list/link-list.component.ts +++ b/src/app/modules/episode/link-list/link-list.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { EpisodeLink } from 'src/app/models/episode'; import { SettingsService } from 'src/app/services/settings.service'; import { BrowserService } from 'src/app/services/browser.service'; +import { allLangColors } from 'src/app/helpers/lang.helper'; @Component({ selector: 'episode-link-list', @@ -11,12 +12,7 @@ import { BrowserService } from 'src/app/services/browser.service'; export class LinkListComponent implements OnInit { @Input() links: EpisodeLink[] = []; @Output() linkClick: EventEmitter = new EventEmitter(); - readonly langColors: { [key: string]: string } = { - vostfr: 'blue', - vostar: 'yellow', - vosten: 'dark', - vf: 'green', - }; + readonly langColors = allLangColors; constructor( private settings: SettingsService, diff --git a/src/app/modules/settings/crawlers/crawlers.component.html b/src/app/modules/settings/crawlers/crawlers.component.html index a1ed4a1..3ea53fb 100644 --- a/src/app/modules/settings/crawlers/crawlers.component.html +++ b/src/app/modules/settings/crawlers/crawlers.component.html @@ -26,7 +26,15 @@

- {{ crawler.name }} + + + {{ crawler.subtitles }} + + {{ crawler.name }} + {{ crawler.baseUrl }} diff --git a/src/app/modules/settings/crawlers/crawlers.component.scss b/src/app/modules/settings/crawlers/crawlers.component.scss index 7f8f668..9815130 100644 --- a/src/app/modules/settings/crawlers/crawlers.component.scss +++ b/src/app/modules/settings/crawlers/crawlers.component.scss @@ -1,3 +1,24 @@ +@import "../../shared/css/badge-colors.scss"; + .ml-8 { margin-left: 8px; } + +.name { + display: flex; + align-items: center; +} + +.badge { + display: inline-block; + line-height: 15px; + padding: 2px 10px; + color: #fff; + font-weight: 500; + font-size: 11px; + text-transform: uppercase; + background: #6c757d; + margin-right: 8px; + border-radius: 4px; + text-align: center; +} diff --git a/src/app/modules/settings/crawlers/crawlers.component.ts b/src/app/modules/settings/crawlers/crawlers.component.ts index 2b30906..9427b1c 100644 --- a/src/app/modules/settings/crawlers/crawlers.component.ts +++ b/src/app/modules/settings/crawlers/crawlers.component.ts @@ -3,6 +3,7 @@ import { SettingsService } from 'src/app/services/settings.service'; import { BrowserService } from 'src/app/services/browser.service'; import { BaseCrawler } from 'src/app/crawlers/abstract/base.crawler'; import { CrawlersService } from 'src/app/services/crawlers.service'; +import { allLangColors } from 'src/app/helpers/lang.helper'; @Component({ selector: 'app-crawlers-settings', @@ -11,6 +12,7 @@ import { CrawlersService } from 'src/app/services/crawlers.service'; }) export class CrawlersComponent implements OnInit { allCrawlers: BaseCrawler[] = []; + readonly langColors = allLangColors; constructor( public settings: SettingsService, diff --git a/src/app/modules/shared/css/badge-colors.scss b/src/app/modules/shared/css/badge-colors.scss new file mode 100644 index 0000000..9b68898 --- /dev/null +++ b/src/app/modules/shared/css/badge-colors.scss @@ -0,0 +1,27 @@ +.badge { + &.blue { + background: #0061aa; + } + &.dark { + background: #34393f; + } + &.pink { + background: #b83280; + } + &.green { + background: #38a169; + } + &.red { + background: #c53030; + } + &.purple { + background: #6b46c1; + } + &.orange { + background: #c05621; + } + &.yellow { + background: #fec107; + color: #1b0e00; + } +}