-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ComicZerosum : from Speedbind to protobuf
Fixes #6222
- Loading branch information
Showing
2 changed files
with
164 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,65 @@ | ||
import SpeedBinb from './templates/SpeedBinb.mjs'; | ||
import Connector from '../engine/Connector.mjs'; | ||
import Manga from '../engine/Manga.mjs'; | ||
|
||
export default class ComicZerosum extends SpeedBinb { | ||
export default class ComicZerosum extends Connector { | ||
|
||
constructor() { | ||
super(); | ||
super.id = 'comiczerosum'; | ||
super.label = 'Comic ゼロサム (Comic ZEROSUM)'; | ||
this.tags = ['manga', 'japanese']; | ||
this.url = 'https://online.ichijinsha.co.jp/zerosum'; | ||
this.data_url = 'https://online.ichijinsha.co.jp/json/zerosum'; | ||
this.url = 'https://zerosumonline.com'; | ||
this.api_url = 'https://api.zerosumonline.com/api/v1/'; | ||
this.protoTypes = '/mjs/connectors/ComicZerosum.proto'; | ||
|
||
} | ||
|
||
async _getMangas() { | ||
const request = new Request(`${this.data_url}/list/name.json`, this.requestOptions); | ||
const data = await this.fetchJSON(request); | ||
async _getMangaFromURI(uri) { | ||
//'https://api.zerosumonline.com/api/v1/title?tag= | ||
const mangaid = uri.href.match(/\/detail\/([\w]+)/)[1]; | ||
const requri = new URL(`title?tag=${mangaid}`, this.api_url); | ||
const responseType = 'ComicZerosum.TitleView'; | ||
const request = new Request(requri, this.requestOptions); | ||
const data = await this.fetchPROTO(request, this.protoTypes, responseType); | ||
return new Manga(this, data.title.tag, data.title.name); | ||
} | ||
|
||
return data.Stories.map(story => { | ||
async _getMangas() { | ||
const uri = new URL('list?category=series&sort=date', this.api_url); | ||
const responseType = 'ComicZerosum.Listview'; | ||
const request = new Request (uri, this.requestOptions); | ||
const data = await this.fetchPROTO(request, this.protoTypes, responseType); | ||
return data.titles.map(element => { | ||
return { | ||
id: story.Work.Tag, | ||
title: story.Work.Name | ||
id: element.tag, | ||
title : element.name.trim() | ||
}; | ||
}); | ||
} | ||
|
||
async _getChapters(manga) { | ||
const request = new Request(`${this.data_url}/works/${manga.id}.json`, this.requestOptions); | ||
const data = await this.fetchJSON(request); | ||
|
||
return data.Work.Stories.map(story => { | ||
//'https://api.zerosumonline.com/api/v1/title?tag= | ||
const uri = new URL(`title?tag=${manga.id}`, this.api_url); | ||
const responseType = 'ComicZerosum.TitleView'; | ||
const request = new Request(uri, this.requestOptions); | ||
const data = await this.fetchPROTO(request, this.protoTypes, responseType); | ||
return data.chapters.map(chapter => { | ||
return { | ||
id: story.Url, | ||
title: story.Name | ||
id: chapter.id, | ||
title: chapter.name.trim() | ||
}; | ||
}); | ||
} | ||
|
||
async _getPages(chapter) { | ||
//https://api.zerosumonline.com/api/v1/viewer?chapter_id= | ||
const uri = new URL(`viewer?chapter_id=${chapter.id}`, this.api_url); | ||
const responseType = 'ComicZerosum.MangaViewerView'; | ||
const request = new Request(uri, { | ||
method: 'POST', | ||
}); | ||
const data = await this.fetchPROTO(request, this.protoTypes, responseType); | ||
return data.pages.filter(page=> page.imageUrl).map(page => page.imageUrl); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
package ComicZerosum; | ||
syntax = "proto3"; | ||
|
||
//Common | ||
message Header { | ||
optional uint32 lastUpdateTime = 1; | ||
optional uint32 nextUpdateTime = 2; | ||
} | ||
|
||
//Mangas | ||
message Listview { | ||
optional Header header = 1; | ||
repeated Title titles = 3; | ||
} | ||
|
||
message Title { | ||
optional uint32 id = 1; | ||
optional string tag = 2; | ||
optional string name = 3; | ||
optional string nameKana = 4; | ||
optional string author = 5; | ||
optional string authorKana = 6; | ||
optional string description = 7; | ||
optional string imgUrl = 8; | ||
optional uint32 startTime = 9; | ||
optional uint32 endTime = 10; | ||
optional bool fanLetterEnable = 11; | ||
optional bool r18Flag = 12; | ||
optional Genres genres = 13; | ||
optional uint32 lastUpdateTime = 14; | ||
optional uint32 latestChapterId = 15; | ||
} | ||
|
||
message Genres { | ||
repeated Genre genre = 1; | ||
} | ||
|
||
message Genre { | ||
optional uint32 id = 1; | ||
optional string name = 2; | ||
} | ||
|
||
message IndependentBook { | ||
optional uint32 id = 1; | ||
optional uint32 titleId = 2; | ||
optional string name = 3; | ||
optional string imageUrl = 4; | ||
optional uint32 releaseTime = 5; | ||
optional uint32 startTime = 6; | ||
optional uint32 endTime = 7; | ||
optional StoreUrls storeUrls = 8; | ||
} | ||
|
||
message StoreUrls { | ||
repeated StoreUrl storeUrl = 1; | ||
} | ||
|
||
message StoreUrl { | ||
optional int32 store = 1; | ||
optional string url = 2; | ||
} | ||
|
||
|
||
//Chapter | ||
|
||
message TitleView { | ||
optional Header header = 1; | ||
optional Title title = 2; | ||
repeated Chapter chapters = 3; | ||
repeated IndependentBook independentBooks = 4; | ||
repeated TitleRelatedBanner titleRelatedBanners = 5; | ||
optional Sns sns = 6; | ||
} | ||
|
||
|
||
|
||
message Chapter { | ||
optional uint32 id = 1; | ||
optional string name = 2; | ||
optional string imageUrl = 3; | ||
optional uint32 startTime = 4; | ||
optional uint32 endTime = 5; | ||
optional string nextUpdateTime = 6; | ||
optional bool fanLetterEnabled = 7; | ||
} | ||
|
||
|
||
message TitleRelatedBanners { | ||
repeated TitleRelatedBanner titleRelatedBanners = 1; | ||
} | ||
|
||
message TitleRelatedBanner { | ||
optional string imageUrl = 1; | ||
optional string url = 2; | ||
} | ||
|
||
message Sns { | ||
optional string facebook = 1; | ||
optional string twitter = 2; | ||
} | ||
|
||
|
||
//Pages | ||
|
||
message MangaViewerView { | ||
optional int32 status = 1; | ||
optional uint32 titleId = 2; | ||
optional string titleTag = 3; | ||
optional string viewerTitle = 4; | ||
repeated MangaPage pages = 5; | ||
} | ||
|
||
message MangaPage { | ||
optional string imageUrl = 1; | ||
optional LastPage lastPage = 2; | ||
} | ||
|
||
message LastPage { | ||
optional uint32 t = 1; | ||
} |