embedded image finishing

This commit is contained in:
Stefan Hardegger
2025-09-17 10:28:35 +02:00
parent e5596b5a17
commit c0b3ae3b72
8 changed files with 740 additions and 20 deletions

View File

@@ -19,6 +19,9 @@ export async function POST(request: NextRequest) {
const scraper = new StoryScraper();
const story = await scraper.scrapeStory(url);
// Check if scraped content contains embedded images
const hasImages = story.content ? /<img[^>]+src=['"'][^'"']*['"][^>]*>/i.test(story.content) : false;
// Debug logging
console.log('Scraped story data:', {
url: url,
@@ -28,10 +31,15 @@ export async function POST(request: NextRequest) {
contentLength: story.content?.length || 0,
contentPreview: story.content?.substring(0, 200) + '...',
tags: story.tags,
coverImage: story.coverImage
coverImage: story.coverImage,
hasEmbeddedImages: hasImages
});
return NextResponse.json(story);
// Add image processing flag to response for frontend handling
return NextResponse.json({
...story,
hasEmbeddedImages: hasImages
});
} catch (error) {
console.error('Story scraping error:', error);