diff --git a/docs/en/picture.md b/docs/en/picture.md index 57d106600..85775e381 100644 --- a/docs/en/picture.md +++ b/docs/en/picture.md @@ -38,6 +38,24 @@ pageClass: routes +## Asian to lick + +### Home + + + +### Category + + + +### Tag + + + +### Search + + + ## BabeHub ### Category diff --git a/docs/picture.md b/docs/picture.md index 40bf21f15..927cd99ec 100644 --- a/docs/picture.md +++ b/docs/picture.md @@ -48,6 +48,24 @@ pageClass: routes +## Asian to lick + +### 首页 + + + +### 分类 + + + +### 标签 + + + +### 搜索 + + + ## BabeHub ### 分类 diff --git a/lib/router.js b/lib/router.js index c335b8675..c2a87a4b1 100644 --- a/lib/router.js +++ b/lib/router.js @@ -4227,6 +4227,9 @@ router.get('/now/news/rank', lazyloadRouteHandler('./routes/now/rank')); // s-hentai router.get('/s-hentai/:id?', lazyloadRouteHandler('./routes/s-hentai')); +// Asian to lick +router.get('/asiantolick/:category?/:keyword?', lazyloadRouteHandler('./routes/asiantolick')); + // Deprecated: DO NOT ADD ROUTE HERE // Research Gate diff --git a/lib/routes/asiantolick/index.js b/lib/routes/asiantolick/index.js new file mode 100644 index 000000000..bb8829fcc --- /dev/null +++ b/lib/routes/asiantolick/index.js @@ -0,0 +1,64 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const category = ctx.params.category ?? ''; + const keyword = ctx.params.keyword ?? ''; + + const rootUrl = 'https://asiantolick.com'; + const currentUrl = `${rootUrl}${category === 'category' ? `/category-${keyword}` : ''}${category === 'tag' ? `/tag-${keyword}` : ''}${category === 'search' ? `/search/${keyword}` : ''}`; + + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const list = $('.miniatura') + .map((_, item) => { + item = $(item); + + return { + link: item.attr('href'), + title: item.find('.titulo_video').text(), + }; + }) + .get(); + + const items = await Promise.all( + list.map((item) => + ctx.cache.tryGet(item.link, async () => { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + + const downloadResponse = await got({ + method: 'get', + url: `${rootUrl}/ajax/download_post.php?ver=1&dir=/down/3_750&post_id=${item.link.match(/post-\d+\//)[1]}&post_name=${item.title}`, + }); + + const content = cheerio.load(detailResponse.data); + + item.enclosure_url = `${rootUrl}/temp_dl/${downloadResponse.data}`; + item.description = `

${content('meta[name="description"]').attr('content')}

Download ZIP`; + + content('.gallery_img').each(function () { + item.description += `
`; + }); + + item.pubDate = parseDate(detailResponse.data.match(/"pubDate": "(.*)",/)[1]); + + return item; + }) + ) + ); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +};