mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-17 13:21:44 +01:00
lazy load html parser
fix license
This commit is contained in:
parent
d758df1b8e
commit
79f45ca5b9
2
LICENSE
2
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
|
||||
|
@ -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<string, OgObjectInteral>();
|
||||
|
||||
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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user