mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
feat: 添加大麦网票务更新 (#3223)
This commit is contained in:
@@ -10,6 +10,14 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="xyqfer" example="/westore/new" path="/westore/new"/>
|
<Route author="xyqfer" example="/westore/new" path="/westore/new"/>
|
||||||
|
|
||||||
|
## 大麦网
|
||||||
|
|
||||||
|
### 票务更新
|
||||||
|
|
||||||
|
<Route author="hoilc" example="/damai/activity/上海/音乐会/全部/柴可夫斯基" path="/damai/activity/:city/:category/:subcategory/:keyword?" :paramsDesc="['城市, 如果不需要限制, 请填入`全部`', '分类, 如果不需要限制, 请填入`全部`', '子分类, 如果不需要限制, 请填入`全部`', '搜索关键字, 置空为不限制']"/>
|
||||||
|
|
||||||
|
城市、分类名、子分类名, 请参见[大麦网搜索页面](https://search.damai.cn/search.htm)
|
||||||
|
|
||||||
## 多抓鱼
|
## 多抓鱼
|
||||||
|
|
||||||
### 搜索结果
|
### 搜索结果
|
||||||
|
|||||||
@@ -1807,4 +1807,7 @@ router.get('/kzfeed/topic/:id', require('./routes/kzfeed/topic'));
|
|||||||
// 腾讯新闻较真查证平台
|
// 腾讯新闻较真查证平台
|
||||||
router.get('/factcheck', require('./routes/tencent/factcheck'));
|
router.get('/factcheck', require('./routes/tencent/factcheck'));
|
||||||
|
|
||||||
|
// 大麦网
|
||||||
|
router.get('/damai/activity/:city/:category/:subcategory/:keyword?', require('./routes/damai/activity'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
28
lib/routes/damai/activity.js
Normal file
28
lib/routes/damai/activity.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const city = ctx.params.city === '全部' ? '' : ctx.params.city;
|
||||||
|
const category = ctx.params.category === '全部' ? '' : ctx.params.category;
|
||||||
|
const subcategory = ctx.params.subcategory === '全部' ? '' : ctx.params.subcategory;
|
||||||
|
const keyword = ctx.params.keyword ? ctx.params.keyword : '';
|
||||||
|
|
||||||
|
const url = `https://search.damai.cn/searchajax.html?keyword=${encodeURIComponent(keyword)}&cty=${encodeURIComponent(city)}&ctl=${encodeURIComponent(category)}&sctl=${encodeURIComponent(
|
||||||
|
subcategory
|
||||||
|
)}&tsg=0&st=&et=&order=3&pageSize=30&currPage=1&tn=`;
|
||||||
|
|
||||||
|
const response = await got.get(url);
|
||||||
|
const data = response.data;
|
||||||
|
const list = data.pageData.resultData;
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `大麦网票务 - ${city ? city : '全国'} - ${category ? category : '全部分类'}${subcategory ? ' - ' + subcategory : ''}${keyword ? ' - ' + keyword : ''}`,
|
||||||
|
link: 'https://search.damai.cn/search.htm',
|
||||||
|
item: list.map((item) => ({
|
||||||
|
title: item.nameNoHtml,
|
||||||
|
author: item.actors ? item.actors.replace(/<[^<>]*>/, '') : '大麦网',
|
||||||
|
description: `<img src="${item.verticalPic}" /><p>${item.description}</p><p>地点:${item.venuecity} | ${item.venue}</p><p>时间:${item.showtime}</p><p>票价:${item.price_str}</p>`,
|
||||||
|
pubDate: new Date(),
|
||||||
|
link: `https://detail.damai.cn/item.htm?id=${item.projectid}`,
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user