{"record":{"id":"e80273195d86f24b","repo":"binary-husky/gpt_academic","slug":"rss-feed-feed-status","errorCode":null,"errorMessage":"获取RSS feed失败，状态码: {feed.status}","messagePattern":"获取RSS feed失败，状态码: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"crazy_functions/review_fns/data_sources/arxiv_source.py","lineNumber":445,"sourceCode":"\n        Raises:\n            ValueError: 如果类别无效\n        \"\"\"\n        try:\n            # 处理类别格式\n            # 1. 转换为小写\n            # 2. 确保多个类别之间使用+连接\n            category = category.lower().replace(' ', '+')\n\n            # 构建RSS feed URL\n            feed_url = f\"https://rss.arxiv.org/rss/{category}\"\n            print(f\"正在获取RSS feed: {feed_url}\")  # 添加调试信息\n\n            feed = feedparser.parse(feed_url)\n\n            # 检查feed是否有效\n            if hasattr(feed, 'status') and feed.status != 200:\n                raise ValueError(f\"获取RSS feed失败，状态码: {feed.status}\")\n\n            if not feed.entries:\n                print(f\"警告：未在feed中找到任何条目\")  # 添加调试信息\n                print(f\"Feed标题: {feed.feed.title if hasattr(feed, 'feed') else '无标题'}\")\n                raise ValueError(f\"无效的arXiv类别或未找到论文: {category}\")\n\n            if debug:\n                # 调试模式：只获取5篇最新论文\n                search = arxiv.Search(\n                    query=f'cat:{category}',\n                    sort_by=arxiv.SortCriterion.SubmittedDate,\n                    sort_order=arxiv.SortOrder.Descending,\n                    max_results=5\n                )\n                results = list(self.client.results(search))\n                return [self._parse_paper_data(result) for result in results]\n\n            # 正常模式：获取所有新论文","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/crazy_functions/review_fns/data_sources/arxiv_source.py#L427-L463","documentation":"In the RSS-based category fetch, feedparser.parse(feed_url) is checked for an HTTP status attribute; any status other than 200 raises ValueError('获取RSS feed失败，状态码: ...'). This happens when rss.arxiv.org answers with an HTTP error (403 rate-limit, 5xx outage, redirect to a block page) rather than the feed XML.","triggerScenarios":"Calling the category/new-paper listing method (e.g. fetch_latest by category like 'cs.AI') while rss.arxiv.org returns 403/429 (aggressive polling or shared cloud IP), 5xx during arXiv maintenance, or when a proxy/VPN intercepts the request and answers with an error page status.","commonSituations":"Scripts polling the RSS feed in a tight loop and hitting arXiv rate limits; running from datacenter IPs (AWS/GCP) that arXiv throttles; corporate proxies that rewrite responses; temporary rss.arxiv.org outages.","solutions":["Wait and retry with backoff (minutes, not seconds) — 403/429 from rss.arxiv.org are almost always rate limiting.","Reduce polling frequency and cache results; arXiv RSS updates roughly daily.","Run from a residential/different IP or configure the proxies setting if the environment blocks rss.arxiv.org.","Check https://status.arxiv.org for feed outages when the status is 5xx."],"exampleFix":"# before\nfeed = feedparser.parse(feed_url)\nif hasattr(feed, 'status') and feed.status != 200:\n    raise ValueError(f'获取RSS feed失败，状态码: {feed.status}')\n\n# after\nfor attempt in range(3):\n    feed = feedparser.parse(feed_url)\n    status = getattr(feed, 'status', None)\n    if status == 200 and feed.entries:\n        break\n    time.sleep(60 * (attempt + 1))\nelse:\n    raise ValueError(f'获取RSS feed失败，状态码: {status}')","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        papers = await source.fetch_by_category(cat)\n        break\n    except ValueError as e:\n        if '状态码' in str(e) and attempt < 2:\n            await asyncio.sleep(60 * (attempt + 1))  # arXiv rate-limits: back off\n            continue\n        raise","preventionTips":["Poll the RSS feed at most once per hour (it updates daily) and cache results.","Run from IPs arXiv does not throttle; configure proxies if egress is filtered.","Watch for 403/429 — they mean backoff, not a code bug."],"tags":["arxiv","rss","feedparser","rate-limit","network"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}