From fc1fcbb53504b1ec780113a072c22a9a5f546447 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 1 Nov 2026 11:28:53 -0500 Subject: [PATCH] feat: add Facebook Reels recipe extraction and social caption modal support --- public/app.js | 19 +++- public/index.html | 6 +- server.js | 182 +++++++++++++++++++++++++++++++++++++++ test_facebook_scraper.js | 64 ++++++++++++++ 4 files changed, 264 insertions(+), 7 deletions(-) create mode 100644 test_facebook_scraper.js diff --git a/public/app.js b/public/app.js index e1a3d34..78f5a36 100644 --- a/public/app.js +++ b/public/app.js @@ -631,6 +631,7 @@ async function handleScrapeSubmit(e) { url: errorData.sourceUrl || url, isInstagram: errorData.isInstagram, isTikTok: errorData.isTikTok, + isFacebook: errorData.isFacebook, author: errorData.author || '', coverImage: errorData.coverImage || '', errorMessage: errorData.error @@ -658,9 +659,9 @@ async function handleScrapeSubmit(e) { } } -// Open Social Caption Extractor Modal (Instagram / TikTok) +// Open Social Caption Extractor Modal (Instagram / TikTok / Facebook) function openSocialCaptionModal(options = {}) { - const { url = '', isInstagram = false, isTikTok = false, author = '', coverImage = '' } = options; + const { url = '', isInstagram = false, isTikTok = false, isFacebook = false, author = '', coverImage = '' } = options; const titleEl = document.getElementById('social-modal-title'); const iconEl = document.getElementById('social-modal-icon'); @@ -676,6 +677,7 @@ function openSocialCaptionModal(options = {}) { const isIg = isInstagram || url.toLowerCase().includes('instagram.com') || url.toLowerCase().includes('instagr.am'); const isTt = isTikTok || url.toLowerCase().includes('tiktok.com'); + const isFb = isFacebook || url.toLowerCase().includes('facebook.com') || url.toLowerCase().includes('fb.watch') || url.toLowerCase().includes('fb.com'); if (isIg) { if (titleEl) titleEl.textContent = 'Instagram Recipe Import'; @@ -695,6 +697,15 @@ function openSocialCaptionModal(options = {}) { if (hintEl) { hintEl.textContent = 'TikTok video caption could not be accessed directly. Paste the video description or recipe text below to extract the recipe automatically!'; } + } else if (isFb) { + if (titleEl) titleEl.textContent = 'Facebook Reel Recipe Import'; + if (iconEl) { + iconEl.setAttribute('data-lucide', 'facebook'); + iconEl.style.color = '#1877F2'; + } + if (hintEl) { + hintEl.textContent = 'Facebook restricts automated extraction of Reel captions and comments. Simply copy the caption text or pinned recipe comment from Facebook and paste it below—ForkFolio will parse the recipe and format the ingredients automatically!'; + } } else { if (titleEl) titleEl.textContent = 'Social Media Recipe Import'; if (iconEl) { @@ -702,7 +713,7 @@ function openSocialCaptionModal(options = {}) { iconEl.style.color = 'var(--primary)'; } if (hintEl) { - hintEl.textContent = 'Paste any recipe caption or culinary text from Instagram, TikTok, or social posts below to extract and format it with AI!'; + hintEl.textContent = 'Paste any recipe caption or culinary text from Instagram, Facebook, TikTok, or social posts below to extract and format it with AI!'; } } @@ -723,7 +734,7 @@ function openSocialCaptionModal(options = {}) { } } if (previewAuthor) { - previewAuthor.textContent = author ? `By ${author}` : (isIg ? 'Instagram Post' : 'Social Post'); + previewAuthor.textContent = author ? `By ${author}` : (isIg ? 'Instagram Post' : isFb ? 'Facebook Reel' : 'Social Post'); } if (previewUrl) { previewUrl.textContent = url || ''; diff --git a/public/index.html b/public/index.html index d001c81..7c66dd1 100644 --- a/public/index.html +++ b/public/index.html @@ -73,13 +73,13 @@
- +
- @@ -628,7 +628,7 @@
- +