Skip to content

Commit

Permalink
Bilibi : support more languages (#5248)
Browse files Browse the repository at this point in the history
* Bilibi : support more languages

 They support more language than Hakuneko.  Currently we have 2 connectors : english and chinese. Urls are differents
Now they also have mangas in french, spanish, and indonesian. We just have to put a language code in one api request
The catch is : you get a different manga ID for a manga and a language. Therefore for gathering mangas list we have to performs loops with langage codes but there will be more manga displayed in list (if we make Bibili 'english' => multilingual')
Or we make different connectors with just a langage code different
But then, since url of website is the same, clipboard copy wont work as many website will have the exact same url
  • Loading branch information
MikeZeDev authored Dec 23, 2022
1 parent 7cbc090 commit d53b10c
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/web/mjs/connectors/BilibiliComics.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ export default class BilibiliComics extends BilibiliManhua {
constructor() {
super();
super.id = 'bilibili-comics';
super.label = 'Bilibili Comics';
super.label = 'Bilibili Comics (English)';
this.tags = [ 'webtoon', 'english' ];
this.url = 'https://www.bilibilicomics.com';
this.lang = 'en';
}
}
16 changes: 16 additions & 0 deletions src/web/mjs/connectors/BilibiliComicsES.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import BilibiliManhua from './BilibiliManhua.mjs';

export default class BilibiliComicsES extends BilibiliManhua {

constructor() {
super();
super.id = 'bilibili-comics-es';
super.label = 'Bilibili Comics (Spanish)';
this.tags = [ 'webtoon', 'spanish' ];
this.url = 'https://www.bilibilicomics.com';
this.lang = 'es';
}
get icon() {
return '/img/connectors/bilibili-comics';
}
}
16 changes: 16 additions & 0 deletions src/web/mjs/connectors/BilibiliComicsFR.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import BilibiliManhua from './BilibiliManhua.mjs';

export default class BilibiliComicsFR extends BilibiliManhua {

constructor() {
super();
super.id = 'bilibili-comics-fr';
super.label = 'Bilibili Comics (French)';
this.tags = [ 'webtoon', 'french' ];
this.url = 'https://www.bilibilicomics.com';
this.lang = 'fr';
}
get icon() {
return '/img/connectors/bilibili-comics';
}
}
16 changes: 16 additions & 0 deletions src/web/mjs/connectors/BilibiliComicsID.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import BilibiliManhua from './BilibiliManhua.mjs';

export default class BilibiliComicsID extends BilibiliManhua {

constructor() {
super();
super.id = 'bilibili-comics-id';
super.label = 'Bilibili Comics (Indonesian)';
this.tags = [ 'webtoon', 'indonesian' ];
this.url = 'https://www.bilibilicomics.com';
this.lang = 'id';
}
get icon() {
return '/img/connectors/bilibili-comics';
}
}
3 changes: 3 additions & 0 deletions src/web/mjs/connectors/BilibiliManhua.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default class BilibiliManhua extends Connector {
super.label = '哔哩哔哩 漫画 (Bilibili Manhua)';
this.tags = [ 'manga', 'webtoon', 'chinese' ];
this.url = 'https://manga.bilibili.com';
this.lang = 'cn';

this.config = {
quality: {
Expand All @@ -29,6 +30,8 @@ export default class BilibiliManhua extends Connector {
const uri = new URL('/twirp/comic.v1.Comic' + path, this.url);
uri.searchParams.set('device', 'pc');
uri.searchParams.set('platform', 'web');
uri.searchParams.set('lang', this.lang);
uri.searchParams.set('sys_lang', this.lang);
const request = new Request(uri, {
method: 'POST',
body: JSON.stringify(body),
Expand Down

0 comments on commit d53b10c

Please sign in to comment.