fix(route): new domain for flyertea (#7633)
Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -55,11 +55,11 @@ IATA 国际航空运输协会机场代码,参见[维基百科 国际航空运
|
||||
|
||||
### 优惠信息
|
||||
|
||||
<Route author="howel52" example="/flyertea/preferential" path="/flyertea/preferential" />
|
||||
<Route author="howel52" example="/flyert/preferential" path="/flyert/preferential" />
|
||||
|
||||
### 信用卡
|
||||
|
||||
<Route author="nicolaszf" example="/flyertea/creditcard/zhongxin" path="/flyertea/creditcard/:bank" :paramsDesc="['信用卡板块各银行的拼音简称']">
|
||||
<Route author="nicolaszf" example="/flyert/creditcard/zhongxin" path="/flyert/creditcard/:bank" :paramsDesc="['信用卡板块各银行的拼音简称']">
|
||||
|
||||
| 信用卡模块 | bank |
|
||||
| ---------- | ------------- |
|
||||
|
||||
+4
-2
@@ -1871,8 +1871,10 @@ router.get('/aiyanxishe/:id/:sort?', lazyloadRouteHandler('./routes/aiyanxishe/h
|
||||
router.get('/huodongxing/explore', lazyloadRouteHandler('./routes/hdx/explore'));
|
||||
|
||||
// 飞客茶馆优惠信息
|
||||
router.get('/flyertea/preferential', lazyloadRouteHandler('./routes/flyertea/preferential'));
|
||||
router.get('/flyertea/creditcard/:bank', lazyloadRouteHandler('./routes/flyertea/creditcard'));
|
||||
router.get('/flyert/preferential', lazyloadRouteHandler('./routes/flyert/preferential'));
|
||||
router.get('/flyert/creditcard/:bank', lazyloadRouteHandler('./routes/flyert/creditcard'));
|
||||
router.get('/flyertea/preferential', lazyloadRouteHandler('./routes/flyert/preferential'));
|
||||
router.get('/flyertea/creditcard/:bank', lazyloadRouteHandler('./routes/flyert/creditcard'));
|
||||
|
||||
// 中国广播
|
||||
router.get('/radio/:channelname/:name', lazyloadRouteHandler('./routes/radio/radio'));
|
||||
|
||||
@@ -4,7 +4,7 @@ const util = require('./utils');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
const gbk2utf8 = (s) => iconv.decode(s, 'gbk');
|
||||
const host = 'https://www.flyertea.com';
|
||||
const host = 'https://www.flyert.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const bank = ctx.params.bank;
|
||||
@@ -72,13 +72,14 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
|
||||
const $ = cheerio.load(gbk2utf8(response.data));
|
||||
|
||||
const list = $("[id*='normalthread']").get();
|
||||
|
||||
const result = await util.ProcessFeed(list, ctx.cache);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `飞客茶馆信用卡 - ${bankname}`,
|
||||
link: 'https://www.flyertea.com/',
|
||||
link: 'https://www.flyert.com/',
|
||||
description: `飞客茶馆信用卡 - ${bankname}`,
|
||||
item: result,
|
||||
};
|
||||
@@ -3,7 +3,7 @@ const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
const gbk2utf8 = (s) => iconv.decode(s, 'gbk');
|
||||
const host = 'https://www.flyertea.com';
|
||||
const host = 'https://www.flyert.com';
|
||||
const target = `${host}/forum.php?mod=forumdisplay&sum=all&fid=all&catid=322`;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -15,7 +15,7 @@ module.exports = async (ctx) => {
|
||||
const items = $('.comiis_wzli');
|
||||
ctx.state.data = {
|
||||
title: '飞客茶馆优惠',
|
||||
link: 'https://www.flyertea.com/',
|
||||
link: 'https://www.flyert.com/',
|
||||
description: '飞客茶馆优惠',
|
||||
item:
|
||||
items &&
|
||||
@@ -32,15 +32,15 @@ async function load(link) {
|
||||
return { description };
|
||||
}
|
||||
|
||||
const ProcessFeed = (list, caches) => {
|
||||
const host = 'https://www.flyertea.com';
|
||||
const ProcessFeed = async (list, caches) => {
|
||||
const host = 'https://www.flyert.com';
|
||||
|
||||
return Promise.all(
|
||||
return await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const $ = cheerio.load(item);
|
||||
|
||||
const $label = $(".comiis_common a[data-track='版块页主题分类']");
|
||||
const $title = $(".comiis_common a[data-track='版块页帖子']");
|
||||
const $title = $(".comiis_common a[data-track='版块页文章']");
|
||||
// 还原相对链接为绝对链接
|
||||
const itemUrl = url.resolve(host, $title.attr('href'));
|
||||
|
||||
@@ -53,7 +53,7 @@ const ProcessFeed = (list, caches) => {
|
||||
|
||||
// 使用tryGet方法从缓存获取内容。
|
||||
// 当缓存中无法获取到链接内容的时候,则使用load方法加载文章内容。
|
||||
const other = await caches.tryGet(itemUrl, () => load(itemUrl));
|
||||
const other = await caches.tryGet(itemUrl, async () => await load(itemUrl));
|
||||
|
||||
// 合并解析后的结果集作为该篇文章最终的输出结果
|
||||
return Promise.resolve(Object.assign({}, single, other));
|
||||
Reference in New Issue
Block a user