fix(crawler/rust): dedupe
This commit is contained in:
@@ -401,13 +401,13 @@ export class WebCrawler {
|
|||||||
|
|
||||||
public async extractLinksFromHTML(html: string, url: string) {
|
public async extractLinksFromHTML(html: string, url: string) {
|
||||||
try {
|
try {
|
||||||
return (await this.extractLinksFromHTMLRust(html, url)).map(x => {
|
return [...new Set((await this.extractLinksFromHTMLRust(html, url)).map(x => {
|
||||||
try {
|
try {
|
||||||
return new URL(x, url).href
|
return new URL(x, url).href
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}).filter(x => x !== null) as string[];
|
}).filter(x => x !== null) as string[])];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error("Failed to call html-transformer! Falling back to cheerio...", {
|
this.logger.error("Failed to call html-transformer! Falling back to cheerio...", {
|
||||||
error,
|
error,
|
||||||
|
|||||||
Reference in New Issue
Block a user