diff --git a/publish-cauca.js b/publish-cauca.js index 3ee0a4c..3e6561b 100644 --- a/publish-cauca.js +++ b/publish-cauca.js @@ -136,13 +136,16 @@ async function run() { let title = `Boletín Gobernación - Mes ${month} #${monthCounts[month] + 1}`; if (cleanCaption.length > 20) { - const lines = cleanCaption.split('\n').map(l => l.trim()).filter(l => l.length > 5); + const lines = cleanCaption.split('\n').map(l => l.replace(/^[\p{Emoji}\s*_*]+/gu, '').trim()).filter(l => l.length > 5); if (lines.length > 0) { title = lines[0]; - if ((title.toUpperCase() === title || title.includes("GOBERNACIÓN") || title.includes("Boletín")) && lines.length > 1) { - title = lines[1]; + const genericTitles = ['flash informativo', 'boletín', 'gobernación del cauca', 'comunicado', 'atención', 'apreciados periodistas', 'medios de comunicación']; + const isGeneric = genericTitles.some(g => title.toLowerCase().includes(g)) || title.toUpperCase() === title || title.length < 25; + + if (isGeneric && lines.length > 1) { + title = `${title} | ${lines[1]}`; } - title = title.replace(/^[\p{Emoji}\s*_*]+/gu, ''); // Remove emojis, stars, underscores + if (title.length > 100) title = title.substring(0, 100) + '...'; } }