fix(route): 百度贴吧 (#14635)

This commit is contained in:
JimenezLi 2024-03-03 23:48:56 +08:00 committed by GitHub
parent 3e41600aa8
commit 6b7b95d1b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -75,7 +75,7 @@ module.exports = {
const qw = searchParams.get('qw');
const kw = searchParams.get('kw');
if (qw) {
const route = `/baidu/tieba/user/${qw}`;
const route = `/baidu/tieba/search/${qw}`;
return kw ? `${route}/kw=${kw}` : route;
}
},

View File

@ -12,7 +12,7 @@ export default async (ctx) => {
// PC端https://tieba.baidu.com/f?kw=${encodeURIComponent(kw)}
// 移动端接口https://tieba.baidu.com/mo/q/m?kw=${encodeURIComponent(kw)}&lp=5024&forum_recommend=1&lm=0&cid=0&has_url_param=1&pn=0&is_ajax=1
const params = { kw: encodeURIComponent(kw) };
ctx._matchedRoute.includes('good') && (params.tab = 'good');
ctx.req.path.includes('good') && (params.tab = 'good');
cid && (params.cid = cid);
const { data } = await got(`https://tieba.baidu.com/f`, {
headers: {

View File

@ -30,7 +30,7 @@ async function getPost(id, lz = 0, pn = 7e6) {
export default async (ctx) => {
const id = ctx.req.param('id');
const lz = ctx._matchedRoute.includes('lz') ? 1 : 0;
const lz = ctx.req.path.includes('lz') ? 1 : 0;
const html = await getPost(id, lz);
const $ = load(html);
const title = $('.core_title_txt').attr('title');