diff --git a/docs/picture.md b/docs/picture.md index 44d023243..49b289ed5 100644 --- a/docs/picture.md +++ b/docs/picture.md @@ -155,15 +155,15 @@ pageClass: routes ### 收藏 - + ### 标签 - + ### 搜索 - + ## Elite Babes diff --git a/lib/v2/ehentai/ehapi.js b/lib/v2/ehentai/ehapi.js index 364b857c3..123eac668 100644 --- a/lib/v2/ehentai/ehapi.js +++ b/lib/v2/ehentai/ehapi.js @@ -192,25 +192,30 @@ async function gatherItemsByPage(cache, url, get_bittorrent = false, embed_thumb return updateBittorrent_url(cache, items); } -async function getFavoritesItems(cache, page, favcat, inline_set, get_bittorrent = false, embed_thumb = false) { +async function getFavoritesItems(cache, favcat, inline_set, page = undefined, get_bittorrent = false, embed_thumb = false) { const response = await ehgot(`favorites.php?favcat=${favcat}&inline_set=${inline_set}`); - if (parseInt(page) === 0) { + if (page) { + return gatherItemsByPage(cache, `favorites.php?favcat=${favcat}&next=${page}`, get_bittorrent, embed_thumb); + } else { const items = await parsePage(cache, response.data, get_bittorrent, embed_thumb); return updateBittorrent_url(cache, items); } - return gatherItemsByPage(cache, `favorites.php?page=${page}&favcat=${favcat}`, get_bittorrent, embed_thumb); } function getSearchItems(cache, params, page = undefined, get_bittorrent = false, embed_thumb = false) { if (page) { - return gatherItemsByPage(cache, `?page=${page}&${params}`, get_bittorrent, embed_thumb); + return gatherItemsByPage(cache, `?${params}&next=${page}`, get_bittorrent, embed_thumb); } else { return gatherItemsByPage(cache, `?${params}`, get_bittorrent, embed_thumb); } } function getTagItems(cache, tag, page, get_bittorrent = false, embed_thumb = false) { - return gatherItemsByPage(cache, `tag/${tag}/${page}`, get_bittorrent, embed_thumb); + if (page) { + return gatherItemsByPage(cache, `tag/${tag}?next=${page}`, get_bittorrent, embed_thumb); + } else { + return gatherItemsByPage(cache, `tag/${tag}`, get_bittorrent, embed_thumb); + } } module.exports = { getFavoritesItems, getSearchItems, getTagItems, has_cookie, from_ex }; diff --git a/lib/v2/ehentai/favorites.js b/lib/v2/ehentai/favorites.js index d049ebc54..d0e1d01eb 100644 --- a/lib/v2/ehentai/favorites.js +++ b/lib/v2/ehentai/favorites.js @@ -5,12 +5,12 @@ module.exports = async (ctx) => { throw 'Ehentai favorites RSS is disabled due to the lack of relevant config'; } const favcat = ctx.params.favcat ? parseInt(ctx.params.favcat) : 0; - const page = ctx.params.page ? parseInt(ctx.params.page) : 0; + const page = ctx.params.page; const routeParams = new URLSearchParams(ctx.params.routeParams); const bittorrent = routeParams.get('bittorrent') || false; const embed_thumb = routeParams.get('embed_thumb') || false; const inline_set = ctx.params.order === 'posted' ? 'fs_p' : 'fs_f'; - const items = await EhAPI.getFavoritesItems(ctx.cache, page, favcat, inline_set, bittorrent, embed_thumb); + const items = await EhAPI.getFavoritesItems(ctx.cache, favcat, inline_set, page, bittorrent, embed_thumb); if (EhAPI.from_ex) { ctx.state.data = { diff --git a/lib/v2/ehentai/search.js b/lib/v2/ehentai/search.js index f63e10ad9..8ca4279ae 100644 --- a/lib/v2/ehentai/search.js +++ b/lib/v2/ehentai/search.js @@ -9,8 +9,8 @@ module.exports = async (ctx) => { let items; if (page) { // 如果定义了page,就要覆盖params - params = params.replace(/&*page=[^&]$/, '').replace(/page=[^&]&/, ''); - items = await EhAPI.getSearchItems(ctx.cache, params, parseInt(page), bittorrent, embed_thumb); + params = params.replace(/&*next=[^&]$/, '').replace(/next=[^&]&/, ''); + items = await EhAPI.getSearchItems(ctx.cache, params, page, bittorrent, embed_thumb); } else { items = await EhAPI.getSearchItems(ctx.cache, params, undefined, bittorrent, embed_thumb); } diff --git a/lib/v2/ehentai/tag.js b/lib/v2/ehentai/tag.js index 6c65241cf..3759df0d2 100644 --- a/lib/v2/ehentai/tag.js +++ b/lib/v2/ehentai/tag.js @@ -1,7 +1,7 @@ const EhAPI = require('./ehapi'); module.exports = async (ctx) => { - const page = ctx.params.page ? parseInt(ctx.params.page) : 0; + const page = ctx.params.page; const tag = ctx.params.tag; const routeParams = new URLSearchParams(ctx.params.routeParams); const bittorrent = routeParams.get('bittorrent') || false;