Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Deploying to gh-pages from @ 8135f5c 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
WaltersAsh committed Aug 13, 2023
1 parent 93c548a commit b075cd4
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 35 deletions.
48 changes: 31 additions & 17 deletions 0.8/Koushoku/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ exports.Koushoku = exports.KoushokuInfo = void 0;
const types_1 = require("@paperback/types");
const KoushokuParser_1 = require("./KoushokuParser");
exports.KoushokuInfo = {
version: '1.0.2',
version: '1.0.4',
name: 'Koushoku',
icon: 'icon.png',
author: 'WaltersAsh',
Expand Down Expand Up @@ -1661,9 +1661,10 @@ exports.Koushoku = Koushoku;
},{"./KoushokuParser":71,"@paperback/types":61}],71:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isLastPage = exports.getPages = exports.getGalleryData = exports.getAlbums = exports.getTags = exports.DOMAIN = void 0;
exports.testImageLink = exports.isLastPage = exports.getPages = exports.getGalleryData = exports.getAlbums = exports.getTags = exports.DOMAIN = void 0;
const entities = require("entities");
exports.DOMAIN = 'https://ksk.moe';
const REGEX_PAGE = /[0-9]+(.(jpg|png))/g;
async function getTags(requestManager, cheerio) {
const request = App.createRequest({
url: `${exports.DOMAIN}/tags/page/1`,
Expand Down Expand Up @@ -1765,22 +1766,22 @@ async function getPages(id, requestManager, cheerio) {
const length = parseInt($('span:contains("Pages")').text().split(' ')[0] ?? '');
const urlPieces = $('img').first().attr('src')?.split('/') ?? '';
const suffix = urlPieces[urlPieces?.length - 1] ?? '';
const imageFormat = suffix.slice(suffix.length, 3) ? 'jpg' : 'png';
const pagesRequest = App.createRequest({
url: `${exports.DOMAIN}/read${id.slice(7)}/1`,
method: 'GET'
});
const pagesData = await requestManager.schedule(pagesRequest, 1);
const $$ = cheerio.load(pagesData.data, { xmlMode: true });
// Image format is not guranteed
// const imageFormat = suffix.slice(suffix.length, 3) ? 'jpg' : 'png';
const pageNumFormat = suffix.split('.')[0]?.length;
if (pageNumFormat === 2) {
for (let i = 1; i < length + 1; i++) {
// Pages start from 01, 02, 03..09, 10, 11...
const imageLink = i < 10 ? `${exports.DOMAIN}/resampled/${imageId}/0${i}.${imageFormat}` : `${exports.DOMAIN}/resampled/${imageId}/${i}.${imageFormat}`;
pages.push(imageLink);
}
}
else if (pageNumFormat === 3) {
for (let i = 1; i < length + 1; i++) {
// Pages start from 001, 002..010, 011..100, 101...
let imageLink = i < 10 ? `${exports.DOMAIN}/resampled/${imageId}/00${i}.${imageFormat}` : `${exports.DOMAIN}/resampled/${imageId}/0${i}.${imageFormat}`;
if (i > 99) {
imageLink = `${exports.DOMAIN}/resampled/${imageId}/${i}.${imageFormat}`;
}
// Extract page nums from script
const pageNums = $$('script[type$=javascript]').last().toString();
const unsortedPageNumsList = pageNums.matchAll(REGEX_PAGE);
const pageNumsList = [...new Set(Array.from(unsortedPageNumsList, x => x[0]))];
if (pageNumFormat === 2 || pageNumFormat === 3) {
for (let i = 0; i < length; i++) {
const imageLink = `${exports.DOMAIN}/resampled/${imageId}/${pageNumsList[i]}`;
pages.push(imageLink);
}
}
Expand All @@ -1807,6 +1808,19 @@ const isLastPage = (albums) => {
return albums.length != 35;
};
exports.isLastPage = isLastPage;
async function testImageLink(imageLink, requestManager) {
const jpgImageLink = imageLink.replace(/.{0,3}$/, '') + 'jpg';
const request = App.createRequest({
url: imageLink,
method: 'GET'
});
const status = (await requestManager.schedule(request, 1)).status;
if (status !== 200) {
return jpgImageLink;
}
return imageLink;
}
exports.testImageLink = testImageLink;

},{"entities":69}]},{},[70])(70)
});
48 changes: 31 additions & 17 deletions 0.8/Koushoku/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ exports.Koushoku = exports.KoushokuInfo = void 0;
const types_1 = require("@paperback/types");
const KoushokuParser_1 = require("./KoushokuParser");
exports.KoushokuInfo = {
version: '1.0.2',
version: '1.0.4',
name: 'Koushoku',
icon: 'icon.png',
author: 'WaltersAsh',
Expand Down Expand Up @@ -1661,9 +1661,10 @@ exports.Koushoku = Koushoku;
},{"./KoushokuParser":71,"@paperback/types":61}],71:[function(require,module,exports){
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isLastPage = exports.getPages = exports.getGalleryData = exports.getAlbums = exports.getTags = exports.DOMAIN = void 0;
exports.testImageLink = exports.isLastPage = exports.getPages = exports.getGalleryData = exports.getAlbums = exports.getTags = exports.DOMAIN = void 0;
const entities = require("entities");
exports.DOMAIN = 'https://ksk.moe';
const REGEX_PAGE = /[0-9]+(.(jpg|png))/g;
async function getTags(requestManager, cheerio) {
const request = App.createRequest({
url: `${exports.DOMAIN}/tags/page/1`,
Expand Down Expand Up @@ -1765,22 +1766,22 @@ async function getPages(id, requestManager, cheerio) {
const length = parseInt($('span:contains("Pages")').text().split(' ')[0] ?? '');
const urlPieces = $('img').first().attr('src')?.split('/') ?? '';
const suffix = urlPieces[urlPieces?.length - 1] ?? '';
const imageFormat = suffix.slice(suffix.length, 3) ? 'jpg' : 'png';
const pagesRequest = App.createRequest({
url: `${exports.DOMAIN}/read${id.slice(7)}/1`,
method: 'GET'
});
const pagesData = await requestManager.schedule(pagesRequest, 1);
const $$ = cheerio.load(pagesData.data, { xmlMode: true });
// Image format is not guranteed
// const imageFormat = suffix.slice(suffix.length, 3) ? 'jpg' : 'png';
const pageNumFormat = suffix.split('.')[0]?.length;
if (pageNumFormat === 2) {
for (let i = 1; i < length + 1; i++) {
// Pages start from 01, 02, 03..09, 10, 11...
const imageLink = i < 10 ? `${exports.DOMAIN}/resampled/${imageId}/0${i}.${imageFormat}` : `${exports.DOMAIN}/resampled/${imageId}/${i}.${imageFormat}`;
pages.push(imageLink);
}
}
else if (pageNumFormat === 3) {
for (let i = 1; i < length + 1; i++) {
// Pages start from 001, 002..010, 011..100, 101...
let imageLink = i < 10 ? `${exports.DOMAIN}/resampled/${imageId}/00${i}.${imageFormat}` : `${exports.DOMAIN}/resampled/${imageId}/0${i}.${imageFormat}`;
if (i > 99) {
imageLink = `${exports.DOMAIN}/resampled/${imageId}/${i}.${imageFormat}`;
}
// Extract page nums from script
const pageNums = $$('script[type$=javascript]').last().toString();
const unsortedPageNumsList = pageNums.matchAll(REGEX_PAGE);
const pageNumsList = [...new Set(Array.from(unsortedPageNumsList, x => x[0]))];
if (pageNumFormat === 2 || pageNumFormat === 3) {
for (let i = 0; i < length; i++) {
const imageLink = `${exports.DOMAIN}/resampled/${imageId}/${pageNumsList[i]}`;
pages.push(imageLink);
}
}
Expand All @@ -1807,6 +1808,19 @@ const isLastPage = (albums) => {
return albums.length != 35;
};
exports.isLastPage = isLastPage;
async function testImageLink(imageLink, requestManager) {
const jpgImageLink = imageLink.replace(/.{0,3}$/, '') + 'jpg';
const request = App.createRequest({
url: imageLink,
method: 'GET'
});
const status = (await requestManager.schedule(request, 1)).status;
if (status !== 200) {
return jpgImageLink;
}
return imageLink;
}
exports.testImageLink = testImageLink;

},{"entities":69}]},{},[70])(70)
});
2 changes: 1 addition & 1 deletion 0.8/versioning.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"buildTime":"2023-07-25T11:37:16.198Z","sources":[{"id":"Buondua","name":"Buondua","author":"WaltersAsh","desc":"Extension to grab albums from Buon Dua","website":"https://github.com/WaltersAsh","contentRating":"ADULT","version":"2.0.0","icon":"icon.png","tags":[{"text":"18+","type":"danger"}],"websiteBaseURL":"https://buondua.com","intents":5},{"id":"Kostaku","name":"Kostaku","author":"WaltersAsh","desc":"Extension to grab albums from Kostaku","website":"https://github.com/WaltersAsh","contentRating":"ADULT","version":"2.0.0","icon":"icon.png","tags":[{"text":"18+","type":"danger"}],"websiteBaseURL":"https://kostaku.art","intents":5},{"id":"Koushoku","name":"Koushoku","author":"WaltersAsh","desc":"Extension to grab albums from Koushoku","website":"https://github.com/WaltersAsh","contentRating":"ADULT","version":"1.0.2","icon":"icon.png","tags":[{"text":"18+","type":"danger"}],"websiteBaseURL":"https://ksk.moe","intents":5},{"id":"Xiutaku","name":"Xiutaku","author":"WaltersAsh","desc":"Extension to grab albums from Xiutaku","website":"https://github.com/WaltersAsh","contentRating":"ADULT","version":"2.0.0","icon":"icon.png","tags":[{"text":"18+","type":"danger"}],"websiteBaseURL":"https://xiutaku.com","intents":5}],"builtWith":{"toolchain":"0.8.0-alpha.47","types":"0.8.0-alpha.47"}}
{"buildTime":"2023-08-13T04:18:42.027Z","sources":[{"id":"Buondua","name":"Buondua","author":"WaltersAsh","desc":"Extension to grab albums from Buon Dua","website":"https://github.com/WaltersAsh","contentRating":"ADULT","version":"2.0.0","icon":"icon.png","tags":[{"text":"18+","type":"danger"}],"websiteBaseURL":"https://buondua.com","intents":5},{"id":"Kostaku","name":"Kostaku","author":"WaltersAsh","desc":"Extension to grab albums from Kostaku","website":"https://github.com/WaltersAsh","contentRating":"ADULT","version":"2.0.0","icon":"icon.png","tags":[{"text":"18+","type":"danger"}],"websiteBaseURL":"https://kostaku.art","intents":5},{"id":"Koushoku","name":"Koushoku","author":"WaltersAsh","desc":"Extension to grab albums from Koushoku","website":"https://github.com/WaltersAsh","contentRating":"ADULT","version":"1.0.4","icon":"icon.png","tags":[{"text":"18+","type":"danger"}],"websiteBaseURL":"https://ksk.moe","intents":5},{"id":"Xiutaku","name":"Xiutaku","author":"WaltersAsh","desc":"Extension to grab albums from Xiutaku","website":"https://github.com/WaltersAsh","contentRating":"ADULT","version":"2.0.0","icon":"icon.png","tags":[{"text":"18+","type":"danger"}],"websiteBaseURL":"https://xiutaku.com","intents":5}],"builtWith":{"toolchain":"0.8.0-alpha.47","types":"0.8.0-alpha.47"}}

0 comments on commit b075cd4

Please sign in to comment.