fix: audit findings — edge cases in paginate, output, run

- paginate.py: max(nums) on empty set → guard
- paginate.py: HEAD fallback to GET if server doesn't support HEAD
- output.py: disk health check every 500 topics
- run.py: avoid page-1 extra redirect
- __main__.py: URL validation (must contain vwts.ru)
This commit is contained in:
2026-06-04 08:58:09 +03:00
parent 010b10c43e
commit 1cfa6d1595
4 changed files with 32 additions and 13 deletions
+8
View File
@@ -39,3 +39,11 @@ def save_topic(section_slug: str, section_name: str, topic: dict,
st["topic_count"] += 1
log.info(f" 💾 part_{st['file_index']:04d}.jsonl "
f"({fpath.stat().st_size/1024/1024:.1f} MB)")
if st["topic_count"] % 500 == 0:
# Каждые 500 тем — проверяем что диск ещё жив
try:
fpath.stat()
except OSError as e:
log.critical(f"❌ Ошибка диска: {e}")
raise