fix: robots.txt laoding

This commit is contained in:
Gergő Móricz 2024-08-15 19:11:07 +02:00
parent 29f0d9ec94
commit c5597bc722

View File

@ -95,25 +95,22 @@ export async function crawlController(req: Request, res: Response) {
await logCrawl(id, team_id);
let robots;
try {
robots = await this.getRobotsTxt();
} catch (_) {}
const sc: StoredCrawl = {
originUrl: url,
crawlerOptions,
pageOptions,
team_id,
robots,
createdAt: Date.now(),
};
await saveCrawl(id, sc);
const crawler = crawlToCrawler(id, sc);
try {
sc.robots = await crawler.getRobotsTxt();
} catch (_) {}
await saveCrawl(id, sc);
const sitemap = sc.crawlerOptions?.ignoreSitemap ? null : await crawler.tryGetSitemap();
if (sitemap !== null) {