Dmitry Beresnev commited on
Commit ·
0e6d54c
1
Parent(s): bb8a8a0
fix news feed
Browse filesFiles changed (2)
80 unmodified lines81828384858687157 unmodified lines24524624724824925025180 unmodified lines<!-- Title --><h3 style='color: #f3f4f6; margin: 0 0 12px 0; font-size: 17px;line-height: 1.5; font-weight: 600;'>{html_module.escape(news_item['summary'])}</h3><!-- Meta info -->157 unmodified linesBREAKING NEWS • {latest['source'].upper()}</div><div style='color: white; font-size: 18px; font-weight: 600; line-height: 1.4;'>{html_module.escape(latest['summary'])}</div></div><a href='{latest['url']}' target='_blank'80 unmodified lines81828384858687157 unmodified lines24524624724824925025180 unmodified lines<!-- Title --><h3 style='color: #f3f4f6; margin: 0 0 12px 0; font-size: 17px;line-height: 1.5; font-weight: 600;'>{news_item.get('summary', '').strip()}</h3><!-- Meta info -->157 unmodified linesBREAKING NEWS • {latest['source'].upper()}</div><div style='color: white; font-size: 18px; font-weight: 600; line-height: 1.4;'>{latest.get('summary', '').strip()}</div></div><a href='{latest['url']}' target='_blank'
238 unmodified lines239240241242243244245246238 unmodified linescontinue# Skip if title looks like it contains HTML comments or codeif '<!--' in title or '-->' in title or 'style=' in title:logger.debug(f"Skipping malformed title from {source_name}: {title[:100]}")continue# Find associated link238 unmodified lines239240241242243244245246247248249250251238 unmodified linescontinue# Skip if title looks like it contains HTML comments or codeif any(marker in title for marker in ['<!--', '-->', 'style=', '<div', '</div>', '<span', '</span>', 'justify-content', 'flex:', 'padding:']):logger.warning(f"Skipping malformed title from {source_name} (contains HTML): {title[:100]}...")continue# Skip if title is suspiciously long (likely scraped wrong element)if len(title) > 500:logger.warning(f"Skipping suspiciously long title from {source_name}: {len(title)} chars")continue# Find associated link
app/components/news.py+2-2
app/services/news_scraper.py+7-2