export const hostname = 'nhentai.net'; export const url = `https://${hostname}/`; export const paths = { books: 'g/', login: 'login/', favorites: 'favorites/', }; export const downloadLinkId = 'download'; export const nextFavoritePageSelector = 'a.next'; export const coverLinkSelector = 'a.cover'; export function getFavoritePageUrl(page?: number): string { return `${url + paths.favorites}${page ? `?page=${page}` : ''}`; } export function getGalleryId(bookUrl: string): string { const regExpExecArray = /https:\/\/nhentai\.net\/g\/(\d+)/.exec(bookUrl); if (regExpExecArray && regExpExecArray[1]) { return regExpExecArray[1]; } else { throw new TypeError(`could not get nhentai gallery if from the book url ${bookUrl}`); } }