#!/usr/bin/env python3 """ Complete pipeline: RSS fetch -> Enhanced processing -> HTML generation """ import json import sys import subprocess from pathlib import Path def run_script(script_path, input_data=None): """Run a Python script and return its output""" cmd = [sys.executable, script_path] if input_data: result = subprocess.run( cmd, input=input_data, text=True, capture_output=True, check=True ) else: result = subprocess.run( cmd, capture_output=True, text=True, check=True ) return result.stdout def main(): """Complete pipeline: RSS fetch -> Enhanced processing -> HTML generation""" try: # Step 1: Get papers from RSS feeds print("Step 1: Fetching papers from RSS feeds...", file=sys.stderr) rss_output = run_script('rss_arxiv_search.py') # Parse the RSS output try: papers = json.loads(rss_output) except json.JSONDecodeError: print("Error: Could not parse RSS output", file=sys.stderr) print("[]") return if not papers: print("No papers found", file=sys.stderr) print("[]") return print(f"Step 2: Found {len(papers)} papers, enhancing translations...", file=sys.stderr) # Step 2: Enhance with better translations and explanations enhanced_output = run_script( 'enhanced_translation.py', json.dumps(papers) ) enhanced_papers = json.loads(enhanced_output) # Step 3: Generate HTML with enhanced information html_content = generate_enhanced_html(enhanced_papers) # Print the HTML content print(html_content) except subprocess.CalledProcessError as e: print(f"Error running script: {e}", file=sys.stderr) print("[]") except Exception as e: print(f"Error in processing: {e}", file=sys.stderr) print("[]") def generate_enhanced_html(papers): """Generate HTML with enhanced translations and explanations""" html = ''' 每日AI前沿速递 - 2026年1月30日

🤖 每日AI前沿速递

2026年1月30日
''' # Add paper cards with enhanced content for paper in papers[:4]: # Limit to first 4 papers # Clean up the abstract import re clean_abstract = re.sub(r'arXiv:[^\\n]*\\nAbstract: ?', '', paper['abstract']) clean_abstract = re.sub(r'\\n', '
', clean_abstract) # Get category tag cat_map = { "embodied": "#具身智能", "representation": "#表征学习", "reinforcement": "#强化学习", "robotics": "#机器人", "general": "#综合" } category_tag = cat_map.get(paper['primary_category'], "#AI研究") # Create tags tags_html = " ".join([f"{tag}" for tag in paper.get('tags', [])[:6]]) html += f'''
{category_tag}

{paper['title']}

✍️ {", ".join(paper['authors'])} | 发布: {paper['published']}
📝 英文摘要:
{clean_abstract[:500]}...
🇨🇳 中文翻译:
{paper.get('accurate_translation', '【待翻译】')}
🔍 技术讲解:
{paper.get('technical_explanation', '【待讲解】')}
{tags_html}
''' html += '''
''' return html if __name__ == "__main__": main()