Files
backend/ftp_test/check_file.py
T
34047007@qq.com 62ca8fa6b8
CI / backend (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
chore: batch commit remaining changes
Includes search engine improvements, Alembic migrations,
new services (pubmed_daily_update, query_expansion),
frontend updates, and documentation sync.
2026-07-27 08:35:12 +08:00

14 lines
503 B
Python

import gzip, io
data = open('pubmed26n1546.xml.gz', 'rb').read()
print(f'File size: {len(data)}')
try:
decomp = gzip.decompress(data)
print(f'Valid gzip! Decompressed: {len(decomp)} bytes')
from lxml import etree
root = etree.parse(io.BytesIO(decomp)).getroot()
articles = root.findall('.//PubmedArticle')
deletes = root.findall('.//DeleteCitation')
print(f'PubmedArticle: {len(articles)}, DeleteCitation: {len(deletes)}')
except Exception as e:
print(f'Corrupted: {e}')