diff --git a/assets/radar-rules.js b/assets/radar-rules.js index eb1790ce3..e3fe1f192 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -1324,4 +1324,23 @@ }, ], }, + 'kuaidi100.com': { + _name: '快递100', + '.': [ + { + title: '快递追踪', + docs: 'https://docs.rsshub.app/other.html#kuai-di-100', + source: '/', + target: (params) => `/kuaidi100/track/${params.com}/${params.postid}`, + script: "({postid: document.querySelector('#postid').value, com: document.querySelector('#selectComBtn').childNodes[1].attributes[1].value})", + verification: (params) => params.com !== 'default' && params.postid, + }, + { + title: '支持的快递公司列表', + docs: 'https://docs.rsshub.app/other.html#kuai-di-100', + source: '/', + target: '/kuaidi100/company', + }, + ], + }, }); diff --git a/docs/other.md b/docs/other.md index cc4f4ca27..21d38d6e0 100644 --- a/docs/other.md +++ b/docs/other.md @@ -252,15 +252,22 @@ type 为 all 时,category 参数不支持 cost 和 free ### 快递订单追踪 - + 快递公司代号如果不能确定,可通过下方快递列表获得。 +::: warning 注意 + +1. 构造链接前请确认所有参数正确:错误`快递公司-订单号`组合将会缓存信息一小段时间防止产生无用查询 +2. 正常查询的订单在未签收状态下不会被缓存:请控制查询频率 +3. 订单完成后请尽快取消订阅,避免资源浪费 + +::: ### 支持的快递公司列表 - + ## 裏垢女子まとめ diff --git a/lib/routes/kuaidi100/index.js b/lib/routes/kuaidi100/index.js index 211f9db49..c3fa5d95f 100644 --- a/lib/routes/kuaidi100/index.js +++ b/lib/routes/kuaidi100/index.js @@ -38,9 +38,9 @@ module.exports = async (ctx) => { // Maybe we can look into isCheck, condition, and state :) // But I just want to make it work for now. ctx.state.data = { - title: `快递 ${company.name}-${number}`, + title: `快递 ${company.name}-${id}`, link: 'https://www.kuaidi100.com', - description: `快递 ${company.name}-${number}`, + description: `快递 ${company.name}-${id}`, item: data.map((item) => ({ title: item.context, description: item.context, diff --git a/lib/routes/kuaidi100/utils.js b/lib/routes/kuaidi100/utils.js index 5a91f7007..0a8062f05 100644 --- a/lib/routes/kuaidi100/utils.js +++ b/lib/routes/kuaidi100/utils.js @@ -205,7 +205,12 @@ module.exports = { // Not yet complete, don't cache for now. // Per owner suggestion } else { - ctx.cache.set(query_key, query); // Finished, or error id + if (query.data[0].context === '查无结果') { + // 查无结果 appears when cookie is invaild, force update cookie. + clearCookie(ctx); + } else { + ctx.cache.set(query_key, query); // Finished, or error id + } } } else { query = JSON.parse(query);