updated crawler type and implemented it

This commit is contained in:
xnacly 2020-12-31 11:55:08 +01:00
parent 316847094e
commit abf416728e

View File

@ -8,11 +8,12 @@ import { URL } from "url";
const router = Router(); const router = Router();
type crawled = { type crawled = {
title: string; id: string;
type: string; ogTitle: string;
description: string; ogType: string;
url: string; ogDescription: string;
image_url: string; ogUrl: string;
cachedImage: string;
}; };
const DEFAULT_FETCH_OPTIONS: any = { const DEFAULT_FETCH_OPTIONS: any = {
@ -59,7 +60,7 @@ router.post("/", bodyParser.json(), async (req, res) => {
await db.data.externals.push({ image: ImageResponseBuffer, id: ID, type: ImageType }); await db.data.externals.push({ image: ImageResponseBuffer, id: ID, type: ImageType });
const new_cache_entry = { id: ID, ogTitle, ogDescription, cachedImage, ogUrl, ogType }; const new_cache_entry: crawled = { id: ID, ogTitle, ogDescription, cachedImage, ogUrl, ogType };
await db.data.crawler.push(new_cache_entry); await db.data.crawler.push(new_cache_entry);
res.send(new_cache_entry); res.send(new_cache_entry);