diff --git a/LICENSE b/LICENSE index 34e8cf2c2..c30a8f47e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2023 Talha Buğra Bulut +Copyright (c) 2023 hzrd149 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/hooks/use-open-graph-data.ts b/src/hooks/use-open-graph-data.ts index 8231144df..15debc631 100644 --- a/src/hooks/use-open-graph-data.ts +++ b/src/hooks/use-open-graph-data.ts @@ -1,7 +1,6 @@ import { useAsync } from "react-use"; -import extractMetaTags from "../lib/open-graph-scraper/extract"; import { fetchWithCorsFallback } from "../helpers/cors"; -import { OgObjectInteral } from "../lib/open-graph-scraper/types"; +import type { OgObjectInteral } from "../lib/open-graph-scraper/types"; const pageExtensions = [".html", ".php", "htm"]; @@ -9,6 +8,8 @@ const openGraphDataCache = new Map(); export default function useOpenGraphData(url: URL) { return useAsync(async () => { + const { default: extractMetaTags } = await import("../lib/open-graph-scraper/extract"); + if (openGraphDataCache.has(url.toString())) return openGraphDataCache.get(url.toString()); const ext = url.pathname.match(/\.[\w+d]+$/)?.[0];