mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-18 01:16:01 +00:00
4.6.7 first pr (#726)
This commit is contained in:
@@ -50,8 +50,11 @@ export const cheerioToHtml = ({
|
||||
.get()
|
||||
.join('\n');
|
||||
|
||||
const title = $('head title').text() || $('h1:first').text() || fetchUrl;
|
||||
|
||||
return {
|
||||
html,
|
||||
title,
|
||||
usedSelector
|
||||
};
|
||||
};
|
||||
@@ -70,7 +73,7 @@ export const urlsFetch = async ({
|
||||
});
|
||||
|
||||
const $ = cheerio.load(fetchRes.data);
|
||||
const { html, usedSelector } = cheerioToHtml({
|
||||
const { title, html, usedSelector } = cheerioToHtml({
|
||||
fetchUrl: url,
|
||||
$,
|
||||
selector
|
||||
@@ -79,6 +82,7 @@ export const urlsFetch = async ({
|
||||
|
||||
return {
|
||||
url,
|
||||
title,
|
||||
content: md,
|
||||
selector: usedSelector
|
||||
};
|
||||
@@ -87,6 +91,7 @@ export const urlsFetch = async ({
|
||||
|
||||
return {
|
||||
url,
|
||||
title: '',
|
||||
content: '',
|
||||
selector: ''
|
||||
};
|
||||
|
Reference in New Issue
Block a user