feat: bilibili mall category
This commit is contained in:
parent
e0d544be9b
commit
d061b61adb
|
|
@ -244,7 +244,13 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
|
|||
|
||||
### 会员购新品上架
|
||||
|
||||
<Route author="DIYgod" example="/bilibili/mall/new" path="/bilibili/mall/new" />
|
||||
<Route author="DIYgod" example="/bilibili/mall/new/1" path="/bilibili/mall/new/:category?" :paramsDesc="['分类,默认全部,见下表']">
|
||||
|
||||
| 全部 | 手办 | 魔力赏 | 周边 | 游戏 |
|
||||
| ---- | ---- | ------ | ---- | ---- |
|
||||
| 0 | 1 | 7 | 3 | 6 |
|
||||
|
||||
</Route>
|
||||
|
||||
### 会员购作品
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ router.get('/bilibili/live/search/:key/:order', require('./routes/bilibili/liveS
|
|||
router.get('/bilibili/live/area/:areaID/:order', require('./routes/bilibili/liveArea'));
|
||||
router.get('/bilibili/fav/:uid/:fid/:disableEmbed?', require('./routes/bilibili/fav'));
|
||||
router.get('/bilibili/blackboard', require('./routes/bilibili/blackboard'));
|
||||
router.get('/bilibili/mall/new', require('./routes/bilibili/mallNew'));
|
||||
router.get('/bilibili/mall/new/:category?', require('./routes/bilibili/mallNew'));
|
||||
router.get('/bilibili/mall/ip/:id', require('./routes/bilibili/mallIP'));
|
||||
router.get('/bilibili/ranking/:rid?/:day?/:arc_type?/:disableEmbed?', require('./routes/bilibili/ranking'));
|
||||
router.get('/bilibili/user/channel/:uid/:cid/:disableEmbed?', require('./routes/bilibili/userChannel'));
|
||||
|
|
|
|||
|
|
@ -1,24 +1,27 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category || 0;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://mall.bilibili.com/mall-c/home/calendar/list?page=new&startWeekNO=0&limitWeekSize=3',
|
||||
url: `https://mall.bilibili.com/mall-c-search/home/new_items/list?pageNum=1&pageSize=20&version=1.0&cityId=0&cateType=${category}`,
|
||||
headers: {
|
||||
Referer: 'https://mall.bilibili.com/date.html?page=new',
|
||||
Referer: 'https://mall.bilibili.com/newdate.html?noTitleBar=1&page=new&from=new_product&loadingShow=1',
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data.data.vo.weeks;
|
||||
const days = [...data[0].days, ...data[1].days];
|
||||
const days = response.data.data.vo.days;
|
||||
const items = [];
|
||||
days.forEach((day) => {
|
||||
items.push(...day.presaleItems);
|
||||
});
|
||||
|
||||
const type = response.data.data.vo.cateTabs.find((item) => item.cateType === response.data.data.vo.currentCateType).cateName;
|
||||
|
||||
ctx.state.data = {
|
||||
title: '会员购新品上架',
|
||||
link: 'https://mall.bilibili.com/date.html?page=new',
|
||||
title: `会员购新品上架-${type}`,
|
||||
link: 'https://mall.bilibili.com/newdate.html?noTitleBar=1&page=new&from=new_product&loadingShow=1',
|
||||
item: items.map((item) => ({
|
||||
title: item.name,
|
||||
description: `${item.name}<br>${item.priceDesc ? `${item.pricePrefix}${item.priceSymbol}${item.priceDesc[0]}` : ''}<br><img src="https:${item.img}"><br><a href="${item.itemUrl}">APP 内打开</a>`,
|
||||
|
|
|
|||
Loading…
Reference in New Issue