diff --git a/netlify/functions/handleMetadata.js b/netlify/functions/handleMetadata.js
index b9bf2ed..e35f22f 100644
--- a/netlify/functions/handleMetadata.js
+++ b/netlify/functions/handleMetadata.js
@@ -20,9 +20,6 @@ function simplifyContent(content) {
// Preserve the title tag and its content
let title = content.match(/
(.*?)<\/title>/i);
title = title ? title[1] : '';
- // Preserve the body tag and its content
- let body = content.match(/(.*?)<\/body>/i);
- body = body ? body[1] : '';
// Extract the body content, if present
let bodyContent = '';
@@ -38,8 +35,8 @@ function simplifyContent(content) {
bodyContent = bodyContent.replace(/.*?<\/script>/gms, '');
bodyContent = bodyContent.replace(/.*?<\/style>/gms, '');
- // Remove all remaining HTML tags, except for title and body
- bodyContent = bodyContent.replace(/<(?!\/?title|\/?body)([^>]+)>/g, '');
+ // Remove all remaining HTML tags, except for title, body, h1-h6, p, and a
+ bodyContent = bodyContent.replace(/<(?!\/?(title|body|h[1-6]|p|a)( [^>]*)?>)([^>]+)>/g, '');
// Manually replace common HTML entities
bodyContent = bodyContent
@@ -64,7 +61,6 @@ function simplifyContent(content) {
return simplifiedContent;
}
-
// Placeholder function to perform GPT analysis for media type and topics using Mistral-7b via OpenRouter
async function performGPTAnalysis(simplifiedContent, apiKey) {
// Implement logic to send content to Mistral-7b via OpenRouter for GPT analysis