More fixes

This commit is contained in:
Christopher
2026-01-22 16:50:09 -08:00
parent e79c7513a5
commit 09df0ab9d3
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -113,9 +113,10 @@ export async function POST(request: Request) {
}
}
// Normalize content for deduplication (strip HTML entities, URLs, whitespace)
// Normalize content for deduplication (strip HTML entities, URLs, whitespace, category suffixes)
const normalizeForDedup = (content: string): string => {
return content
.replace(/Posted into [\w\s-]+/gi, '') // Remove "Posted into [Category]" patterns
.replace(/&[a-z]+;/gi, '') // Remove HTML entities like ‘
.replace(/&#\d+;/g, '') // Remove numeric entities
.replace(/https?:\/\/[^\s]+/gi, '') // Remove URLs
@@ -123,7 +124,7 @@ const normalizeForDedup = (content: string): string => {
.replace(/\s+/g, ' ') // Normalize whitespace
.toLowerCase()
.trim()
.slice(0, 100); // Compare first 100 chars
.slice(0, 50); // Compare first 50 chars (article title)
};
// Helper to transform cached remote posts to match local post format
+3 -2
View File
@@ -71,9 +71,10 @@ const stripFirstUrl = (text: string, url: string) => {
return `${before} ${after}`.trim();
};
// Normalize content for deduplication (strip HTML entities, URLs, whitespace)
// Normalize content for deduplication (strip HTML entities, URLs, whitespace, category suffixes)
const normalizeForDedup = (content: string): string => {
return content
.replace(/Posted into [\w\s-]+/gi, '') // Remove "Posted into [Category]" patterns
.replace(/&[a-z]+;/gi, '') // Remove HTML entities like ‘
.replace(/&#\d+;/g, '') // Remove numeric entities
.replace(/https?:\/\/[^\s]+/gi, '') // Remove URLs
@@ -81,7 +82,7 @@ const normalizeForDedup = (content: string): string => {
.replace(/\s+/g, ' ') // Normalize whitespace
.toLowerCase()
.trim()
.slice(0, 100); // Compare first 100 chars
.slice(0, 50); // Compare first 50 chars (article title)
};
const parseRemoteHandle = (handle: string) => {