Skip to content

Commit

Permalink
chore: add wawanimes crawler
Browse files Browse the repository at this point in the history
  • Loading branch information
AXeL-dev committed Jul 15, 2022
1 parent 5121748 commit 4cc9e54
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/crawlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { VostFreeCrawler } from './vostfr/vostfree.crawler';
import { WacVostfrCrawler } from './vostfr/wacvostfr.crawler';
import { ElevenAnimCrawler } from './vostfr/11anim.crawler';
import { VostAnimezCrawler } from './vostfr/vostanimez.crawler';
import { WawAnimesCrawler } from './vostfr/wawanimes.crawler';
import { JetAnimesCrawler } from './vostfr/jetanimes.crawler';
import { AnimeCompletCrawler } from './vostfr/animecomplet.crawler';

Expand All @@ -45,6 +46,7 @@ const crawlersList = {
VoirAnimeCrawler,
VoirAnimeOrgCrawler,
VostAnimezCrawler,
WawAnimesCrawler,
JetAnimesCrawler,
AnimeCompletCrawler,
ElevenAnimCrawler,
Expand Down
1 change: 0 additions & 1 deletion src/app/crawlers/vostfr/vostanimez.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { LatestEpisodesCrawler } from '../abstract/latest-episodes.crawler';
import { ScraperService } from '../../services/scraper.service';
import { Episode } from '../../models/episode';
import { Observable } from 'rxjs';
import { now } from 'src/app/helpers/date.helper';

export class VostAnimezCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
Expand Down
46 changes: 46 additions & 0 deletions src/app/crawlers/vostfr/wawanimes.crawler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { LatestEpisodesCrawler } from '../abstract/latest-episodes.crawler';
import { ScraperService } from '../../services/scraper.service';
import { Episode } from '../../models/episode';
import { Observable } from 'rxjs';

export class WawAnimesCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
super('WawAnimes', 'https://wawanimes.tv');
this.filters = {
...this.filters,
title: (text: string) => {
return text.replace(/(.*) \(([A-Za-z]+)\)$/i, '$1');
},
number: (text: string) => {
const num = text.match(/(.*) episode (\d+)/i);
return num?.length ? +num[2] : 1;
},
subtitles: (text: string) => {
const sub = text.match(/(.*) \(([A-Za-z]+)\)$/i);
return sub?.length ? sub[2].toLowerCase() : 'vostfr';
},
};
}

_getLatestEpisodes(): Observable<Episode[]> {
return this.scraper.scrape(
`${this.baseUrl}/liste-des-episodes/`,
'section ul.Episodes > li',
{
anime: {
title: '.Title | title',
cover: '.Image img@src | concatProtocol',
},
number: '.ClB | number',
streamLinks: [
{
url: 'article > a@href',
lang: '.Title | subtitles',
},
],
releaseDate: '.Year | date',
},
this.filters
);
}
}

0 comments on commit 4cc9e54

Please sign in to comment.