diff --git a/docs/travel.md b/docs/travel.md index 032eda47f4..57f8c73d4c 100644 --- a/docs/travel.md +++ b/docs/travel.md @@ -90,6 +90,11 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 +## 活动行 + +### 最新活动 + + ## 马蜂窝 ### 游记 diff --git a/lib/router.js b/lib/router.js index f9f296ccc2..6197f10b4e 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1453,6 +1453,9 @@ router.get('/sixthtone/news', require('./routes/sixthtone/news')); // AI研习社 router.get('/aiyanxishe/:id/:sort?', require('./routes/aiyanxishe/home')); +// 活动行 +router.get('/huodongxing/explore', require('./routes/hdx/explore')); + // 飞客茶馆优惠信息 router.get('/flyertea/preferential', require('./routes/flyertea/preferential')); router.get('/flyertea/creditcard/:bank', require('./routes/flyertea/creditcard')); diff --git a/lib/routes/hdx/explore.js b/lib/routes/hdx/explore.js new file mode 100644 index 0000000000..6c846a7f55 --- /dev/null +++ b/lib/routes/hdx/explore.js @@ -0,0 +1,44 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const response = await got({ + method: 'get', + url: 'https://www.huodongxing.com/eventlist', + }); + + const data = response.data; + const $ = cheerio.load(data); + + const list = $('div.search-tab-content-item'); + + ctx.state.data = { + title: '活动行', + link: 'https://www.huodongxing.com/eventlist', + item: + list && + list + .map((index, item) => { + item = $(item); + return { + title: item + .find('.item-title') + .text() + .trim(), + link: item.find('.item-title').attr('href'), + description: + item.find('.item-data').text() + + ' ' + + item + .find('.item-dress') + .text() + .trim(), + author: item + .find('.user-name') + .text() + .trim(), + }; + }) + .get(), + }; +};