fix(route): 百度贴吧 (#14635)
This commit is contained in:
parent
3e41600aa8
commit
6b7b95d1b3
|
|
@ -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;
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue