From 33079534e0e5459fe29eafd2c9997932c95f645c Mon Sep 17 00:00:00 2001 From: sinkaroid Date: Wed, 8 Jun 2022 14:52:56 +0700 Subject: [PATCH] feat(modifier): add `getIdRandomNhentai` method --- src/utils/modifier.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils/modifier.ts b/src/utils/modifier.ts index bc96c8b..3875f17 100644 --- a/src/utils/modifier.ts +++ b/src/utils/modifier.ts @@ -82,6 +82,16 @@ export async function getIdRandomPururin (): Promise { return parseInt(randomgallery); } +export async function getIdRandomNhentai (): Promise { + const res: any = await p({ + url: `${c.NHENTAI}/random`, + followRedirects: true, + }); + + const getId = res.socket._httpMessage.path; + return parseInt(getId.replace(/^\/g\/([0-9]+)\/?$/, "$1")); +} + export { getPururinInfo, getPururinPageCount, getUrl, getId, getDate, timeAgo, mock, getPururinLanguage, removeNonNumeric }; \ No newline at end of file