#!/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 = '''