mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
feat: add new route flyertea (#2431)
* feat: add new route flyertea * fix: docs error fix
This commit is contained in:
@@ -45,6 +45,12 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
|
||||
|
||||
</Route>
|
||||
|
||||
## 飞客茶馆
|
||||
|
||||
### 优惠信息
|
||||
|
||||
<Route author="howel52" example="/flyertea/preferential" path="/flyertea/preferential" />
|
||||
|
||||
## 国家地理
|
||||
|
||||
### 分类
|
||||
|
||||
@@ -1421,4 +1421,7 @@ router.get('/sixthtone/news', require('./routes/sixthtone/news'));
|
||||
// AI研习社
|
||||
router.get('/aiyanxishe/:id/:sort?', require('./routes/aiyanxishe/home'));
|
||||
|
||||
// 飞客茶馆优惠信息
|
||||
router.get('/flyertea/preferential', require('./routes/flyertea/preferential'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
33
lib/routes/flyertea/preferential.js
Normal file
33
lib/routes/flyertea/preferential.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
const gbk2utf8 = (s) => iconv.decode(s, 'gbk');
|
||||
const host = 'https://www.flyertea.com';
|
||||
const target = `${host}/forum.php?mod=forumdisplay&sum=all&fid=all&catid=322`;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got.get(target, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const $ = cheerio.load(gbk2utf8(response.data));
|
||||
const items = $('.comiis_wzli');
|
||||
ctx.state.data = {
|
||||
title: '飞客茶馆优惠',
|
||||
link: 'https://www.flyertea.com/',
|
||||
description: '飞客茶馆优惠',
|
||||
item:
|
||||
items &&
|
||||
items
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('.wzbt').text(),
|
||||
description: item.find('.wznr > div:first-child').text(),
|
||||
link: `${host}/${item.find('.wzbt a').attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user