Dmitry Beresnev commited on
Commit ·
0e6d54c
1
Parent(s): bb8a8a0
fix news feed
Browse filesFiles changed (2)
80 unmodified lines8182838484858687157 unmodified lines24524624724824824925025180 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'])} {news_item.get('summary', '').strip()} </h3>
<!-- Meta info -->157 unmodified lines BREAKING NEWS • {latest['source'].upper()} </div> <div style='color: white; font-size: 18px; font-weight: 600; line-height: 1.4;'> {html_module.escape(latest['summary'])} {latest.get('summary', '').strip()} </div> </div> <a href='{latest['url']}' target='_blank'238 unmodified lines239240241242243242243244245246247248249250251238 unmodified lines continue
# Skip if title looks like it contains HTML comments or code if '<!--' in title or '-->' in title or 'style=' in title: logger.debug(f"Skipping malformed title from {source_name}: {title[:100]}") if 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 linkapp/components/news.py+2-2
app/services/news_scraper.py+7-2