From f0b4864752526fdf1201b1b60a746da42e175314 Mon Sep 17 00:00:00 2001 From: Ethan Shen Date: Tue, 22 Feb 2022 20:04:19 +0800 Subject: [PATCH] fix(route): remove flyert ads (#9172) --- lib/router.js | 8 ++++---- lib/{routes => v2}/flyert/creditcard.js | 0 lib/v2/flyert/maintainer.js | 4 ++++ lib/{routes => v2}/flyert/preferential.js | 0 lib/v2/flyert/radar.js | 19 +++++++++++++++++++ lib/v2/flyert/router.js | 4 ++++ lib/{routes => v2}/flyert/utils.js | 3 ++- 7 files changed, 33 insertions(+), 5 deletions(-) rename lib/{routes => v2}/flyert/creditcard.js (100%) create mode 100644 lib/v2/flyert/maintainer.js rename lib/{routes => v2}/flyert/preferential.js (100%) create mode 100644 lib/v2/flyert/radar.js create mode 100644 lib/v2/flyert/router.js rename lib/{routes => v2}/flyert/utils.js (96%) diff --git a/lib/router.js b/lib/router.js index e078cf45e..d0d95b602 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1808,10 +1808,10 @@ router.get('/aiyanxishe/:id/:sort?', lazyloadRouteHandler('./routes/aiyanxishe/h router.get('/huodongxing/explore', lazyloadRouteHandler('./routes/hdx/explore')); // 飞客茶馆优惠信息 -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('/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')); diff --git a/lib/routes/flyert/creditcard.js b/lib/v2/flyert/creditcard.js similarity index 100% rename from lib/routes/flyert/creditcard.js rename to lib/v2/flyert/creditcard.js diff --git a/lib/v2/flyert/maintainer.js b/lib/v2/flyert/maintainer.js new file mode 100644 index 000000000..0faacf209 --- /dev/null +++ b/lib/v2/flyert/maintainer.js @@ -0,0 +1,4 @@ +module.exports = { + '/preferential': ['howel52'], + '/creditcard/:bank': ['nicolaszf'], +}; diff --git a/lib/routes/flyert/preferential.js b/lib/v2/flyert/preferential.js similarity index 100% rename from lib/routes/flyert/preferential.js rename to lib/v2/flyert/preferential.js diff --git a/lib/v2/flyert/radar.js b/lib/v2/flyert/radar.js new file mode 100644 index 000000000..87dbc96c0 --- /dev/null +++ b/lib/v2/flyert/radar.js @@ -0,0 +1,19 @@ +module.exports = { + 'flyert.com': { + _name: '飞客茶馆', + '.': [ + { + title: '优惠信息', + docs: 'https://docs.rsshub.app/travel.html#fei-ke-cha-guan-you-hui-xin-xi', + source: '/', + target: '/flyert/preferential', + }, + { + title: '信用卡', + docs: 'https://docs.rsshub.app/travel.html#fei-ke-cha-guan-xin-yong-ka', + source: '/', + target: '/flyert/creditcard/:bank', + }, + ], + }, +}; diff --git a/lib/v2/flyert/router.js b/lib/v2/flyert/router.js new file mode 100644 index 000000000..c409a28b3 --- /dev/null +++ b/lib/v2/flyert/router.js @@ -0,0 +1,4 @@ +module.exports = function (router) { + router.get('/preferential', require('./preferential')); + router.get('/creditcard/:bank', require('./creditcard')); +}; diff --git a/lib/routes/flyert/utils.js b/lib/v2/flyert/utils.js similarity index 96% rename from lib/routes/flyert/utils.js rename to lib/v2/flyert/utils.js index 12649498c..d5ba85061 100644 --- a/lib/routes/flyert/utils.js +++ b/lib/v2/flyert/utils.js @@ -13,7 +13,8 @@ async function load(link) { // 去除全文末尾多与内容 $('.lookMore').remove(); - $('script').remove(); + $('script, style').remove(); + $('#loginDialog').remove(); // 修改图片中的链接 $('ignore_js_op img').each(function () {