fix: [Xiaohongshu] remove Dom object from description (#4594)
This commit is contained in:
parent
87e06feb49
commit
1ddc2b30e9
|
|
@ -1,13 +1,11 @@
|
|||
const { getContent } = require('@/routes/xiaohongshu/util');
|
||||
|
||||
const JSON5 = require('json5');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `https://www.xiaohongshu.com/board/${ctx.params.board_id}`;
|
||||
const content = await getContent(url);
|
||||
const regex = /_SSR_STATE__\S*=([\s\S]+)<\/script>/gm;
|
||||
const match = regex.exec(content);
|
||||
const main = JSON5.parse(match[1]).Main;
|
||||
const main = JSON.parse(match[1]).Main;
|
||||
|
||||
const albumInfo = main.albumInfo;
|
||||
const title = `${albumInfo.name}`;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
const { getContent } = require('@/routes/xiaohongshu/util');
|
||||
|
||||
const cheerio = require('cheerio');
|
||||
const JSON5 = require('json5');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const userId = ctx.params.user_id;
|
||||
|
|
@ -10,10 +9,10 @@ module.exports = async (ctx) => {
|
|||
|
||||
const content = await getContent(url);
|
||||
const $ = cheerio.load(content);
|
||||
const description = $('head title');
|
||||
const description = $('head title').html();
|
||||
const regex = /_SSR_STATE__\S*=([\s\S]+)<\/script>/gm;
|
||||
const match = regex.exec(content);
|
||||
const main = JSON5.parse(match[1]).Main;
|
||||
const main = JSON.parse(match[1]).Main;
|
||||
const userDetail = main.userDetail;
|
||||
if (category === 'notes') {
|
||||
const list = main.notesDetail;
|
||||
|
|
|
|||
Loading…
Reference in New Issue