bookget 0.3.2__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bookget-0.3.2 → bookget-0.3.4}/PKG-INFO +1 -1
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/base.py +9 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/iiif/base_iiif.py +125 -4
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/iiif/kyoto.py +5 -5
- {bookget-0.3.2 → bookget-0.3.4}/bookget/core/resource_manager.py +11 -2
- {bookget-0.3.2 → bookget-0.3.4}/bookget/main.py +41 -9
- {bookget-0.3.2 → bookget-0.3.4}/bookget.egg-info/PKG-INFO +1 -1
- {bookget-0.3.2 → bookget-0.3.4}/pyproject.toml +1 -1
- {bookget-0.3.2 → bookget-0.3.4}/README.md +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/__main__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/iiif/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/iiif/harvard.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/iiif/ndl.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/iiif/princeton.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/iiif/stanford.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/archive_org.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/ctext.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/european.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/hanchi.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/nlc_guji.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/shidianguji.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/taiwan.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/wikimedia_commons.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/other/wikisource.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/adapters/registry.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/config.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/core/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/downloaders/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/downloaders/base.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/downloaders/iiif.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/exceptions.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/logger.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/models/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/models/book.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/models/manifest.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/models/search.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/scripts/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/scripts/images_to_pdf.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/scripts/siku_catalog_parser.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/scripts/strip_tu_marker.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/server/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/server/app.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/server/routes.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/server/sse.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/server/static.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/server/tasks.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/storage/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/storage/file_storage.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/text_converters/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/text_converters/markdown_converter.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/text_converters/plaintext_converter.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/text_parsers/__init__.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/text_parsers/base.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/text_parsers/ctext_parser.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/text_parsers/hanchi_parser.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/text_parsers/shidianguji_parser.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/text_parsers/wikisource_parser.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget/utils.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget.egg-info/SOURCES.txt +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget.egg-info/dependency_links.txt +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget.egg-info/entry_points.txt +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget.egg-info/requires.txt +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/bookget.egg-info/top_level.txt +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/setup.cfg +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_adapters.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_config.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_downloaders.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_exceptions.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_file_storage.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_hanchi.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_manifest.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_models.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_resource_manager.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_text_parsers.py +0 -0
- {bookget-0.3.2 → bookget-0.3.4}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bookget
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Download and parse ancient Chinese book resources from digital libraries
|
|
5
5
|
Keywords: ancient-books,digital-library,downloader,classical-chinese
|
|
6
6
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -306,6 +306,15 @@ class BaseSiteAdapter(ABC):
|
|
|
306
306
|
total_items=len(vol_images),
|
|
307
307
|
source_data={
|
|
308
308
|
"image_urls": [img.url for img in vol_images],
|
|
309
|
+
"images": [
|
|
310
|
+
{
|
|
311
|
+
"url": img.url,
|
|
312
|
+
"filename": img.get_filename(),
|
|
313
|
+
"page": img.page,
|
|
314
|
+
"volume": img.volume,
|
|
315
|
+
}
|
|
316
|
+
for img in vol_images
|
|
317
|
+
],
|
|
309
318
|
},
|
|
310
319
|
)
|
|
311
320
|
root.children.append(vol_node)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Base IIIF Adapter - Handles IIIF-compatible digital libraries
|
|
2
2
|
|
|
3
|
+
import asyncio
|
|
4
|
+
import os
|
|
3
5
|
import re
|
|
6
|
+
from pathlib import Path
|
|
4
7
|
from typing import List, Optional, Dict, Any
|
|
5
8
|
from urllib.parse import urlparse, urljoin
|
|
6
9
|
import aiohttp
|
|
@@ -8,6 +11,7 @@ import aiohttp
|
|
|
8
11
|
from ..base import BaseSiteAdapter
|
|
9
12
|
from ..registry import AdapterRegistry
|
|
10
13
|
from ...models.book import BookMetadata, Resource, ResourceType, Creator
|
|
14
|
+
from ...models.manifest import ManifestNode, NodeStatus
|
|
11
15
|
from ...logger import logger
|
|
12
16
|
from ...exceptions import MetadataExtractionError
|
|
13
17
|
|
|
@@ -29,10 +33,32 @@ class BaseIIIFAdapter(BaseSiteAdapter):
|
|
|
29
33
|
|
|
30
34
|
# Subclasses should override these
|
|
31
35
|
manifest_url_template: str = "" # e.g., "https://example.com/iiif/{book_id}/manifest.json"
|
|
32
|
-
|
|
36
|
+
|
|
37
|
+
# IIIF Image API "size" parameter used when constructing download URLs.
|
|
38
|
+
# Defaults to "full" (IIIF 2.x); IIIF 3 sites may override to "max".
|
|
39
|
+
# Common values: "full" / "max" / "1600," / "2400," / ",1600".
|
|
40
|
+
DEFAULT_IIIF_SIZE: str = "full"
|
|
41
|
+
|
|
33
42
|
def __init__(self, config=None):
|
|
34
43
|
super().__init__(config)
|
|
35
44
|
self._session: Optional[aiohttp.ClientSession] = None
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def iiif_size(self) -> str:
|
|
48
|
+
"""
|
|
49
|
+
Resolve IIIF Image API size parameter for downloads.
|
|
50
|
+
|
|
51
|
+
Priority:
|
|
52
|
+
1. BOOKGET_<SITE>_IIIF_SIZE environment variable
|
|
53
|
+
2. BOOKGET_IIIF_SIZE environment variable (global)
|
|
54
|
+
3. self.DEFAULT_IIIF_SIZE
|
|
55
|
+
"""
|
|
56
|
+
site_var = f"BOOKGET_{(self.site_id or '').upper()}_IIIF_SIZE"
|
|
57
|
+
return (
|
|
58
|
+
os.environ.get(site_var)
|
|
59
|
+
or os.environ.get("BOOKGET_IIIF_SIZE")
|
|
60
|
+
or self.DEFAULT_IIIF_SIZE
|
|
61
|
+
)
|
|
36
62
|
|
|
37
63
|
async def get_session(self) -> aiohttp.ClientSession:
|
|
38
64
|
"""Get or create HTTP session."""
|
|
@@ -187,10 +213,10 @@ class BaseIIIFAdapter(BaseSiteAdapter):
|
|
|
187
213
|
width = resource_data.get("width", canvas.get("width", 0))
|
|
188
214
|
height = resource_data.get("height", canvas.get("height", 0))
|
|
189
215
|
|
|
190
|
-
# Construct
|
|
216
|
+
# Construct image URL at the configured size if we have a service ID
|
|
191
217
|
if service_id:
|
|
192
|
-
# IIIF Image API
|
|
193
|
-
image_url = f"{service_id}/full/
|
|
218
|
+
# IIIF Image API: {service_id}/full/{size}/0/default.jpg
|
|
219
|
+
image_url = f"{service_id}/full/{self.iiif_size}/0/default.jpg"
|
|
194
220
|
|
|
195
221
|
resource = Resource(
|
|
196
222
|
url=image_url,
|
|
@@ -205,6 +231,101 @@ class BaseIIIFAdapter(BaseSiteAdapter):
|
|
|
205
231
|
|
|
206
232
|
return resources
|
|
207
233
|
|
|
234
|
+
async def download_node(
|
|
235
|
+
self,
|
|
236
|
+
book_id: str,
|
|
237
|
+
node: ManifestNode,
|
|
238
|
+
output_dir: Path,
|
|
239
|
+
progress_callback=None,
|
|
240
|
+
) -> ManifestNode:
|
|
241
|
+
"""
|
|
242
|
+
Download all images for a manifest volume node.
|
|
243
|
+
|
|
244
|
+
Reads ``node.source_data["images"]`` (list of {url, filename, page,
|
|
245
|
+
volume} dicts) populated by ``_discover_from_legacy``, and writes
|
|
246
|
+
each image into ``output_dir`` using its filename. Falls back to
|
|
247
|
+
``image_urls`` for backward compatibility.
|
|
248
|
+
|
|
249
|
+
Concurrency is controlled by the adapter's config
|
|
250
|
+
(``config.download.concurrent_downloads``, default 4).
|
|
251
|
+
"""
|
|
252
|
+
images = node.source_data.get("images")
|
|
253
|
+
if not images:
|
|
254
|
+
urls = node.source_data.get("image_urls", [])
|
|
255
|
+
images = [
|
|
256
|
+
{"url": u, "filename": f"{i + 1:04d}.jpg"}
|
|
257
|
+
for i, u in enumerate(urls)
|
|
258
|
+
]
|
|
259
|
+
|
|
260
|
+
if not images:
|
|
261
|
+
logger.warning(f"Node {node.id} has no images")
|
|
262
|
+
node.status = NodeStatus.FAILED
|
|
263
|
+
return node
|
|
264
|
+
|
|
265
|
+
node.status = NodeStatus.DOWNLOADING
|
|
266
|
+
node.total_items = len(images)
|
|
267
|
+
output_dir = Path(output_dir)
|
|
268
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
269
|
+
|
|
270
|
+
session = await self.get_session()
|
|
271
|
+
headers = self.get_headers()
|
|
272
|
+
|
|
273
|
+
# Concurrency from config; fallback to 4
|
|
274
|
+
concurrency = 4
|
|
275
|
+
min_size = 1024
|
|
276
|
+
if self.config and hasattr(self.config, "download"):
|
|
277
|
+
concurrency = max(1, self.config.download.concurrent_downloads)
|
|
278
|
+
min_size = self.config.download.min_image_size
|
|
279
|
+
|
|
280
|
+
semaphore = asyncio.Semaphore(concurrency)
|
|
281
|
+
downloaded = 0
|
|
282
|
+
failed = 0
|
|
283
|
+
|
|
284
|
+
async def fetch_one(item: dict) -> bool:
|
|
285
|
+
nonlocal downloaded, failed
|
|
286
|
+
url = item["url"]
|
|
287
|
+
filename = item.get("filename") or url.rsplit("/", 1)[-1]
|
|
288
|
+
out_path = output_dir / filename
|
|
289
|
+
|
|
290
|
+
if out_path.exists() and out_path.stat().st_size >= min_size:
|
|
291
|
+
downloaded += 1
|
|
292
|
+
if progress_callback:
|
|
293
|
+
progress_callback(downloaded, len(images))
|
|
294
|
+
return True
|
|
295
|
+
|
|
296
|
+
async with semaphore:
|
|
297
|
+
try:
|
|
298
|
+
async with session.get(url, headers=headers) as resp:
|
|
299
|
+
resp.raise_for_status()
|
|
300
|
+
content = await resp.read()
|
|
301
|
+
if len(content) < min_size:
|
|
302
|
+
logger.warning(f"Image too small: {filename}")
|
|
303
|
+
failed += 1
|
|
304
|
+
return False
|
|
305
|
+
out_path.write_bytes(content)
|
|
306
|
+
downloaded += 1
|
|
307
|
+
if progress_callback:
|
|
308
|
+
progress_callback(downloaded, len(images))
|
|
309
|
+
return True
|
|
310
|
+
except Exception as e:
|
|
311
|
+
logger.warning(f"Failed {url}: {e}")
|
|
312
|
+
failed += 1
|
|
313
|
+
return False
|
|
314
|
+
|
|
315
|
+
await asyncio.gather(*[fetch_one(it) for it in images])
|
|
316
|
+
|
|
317
|
+
node.downloaded_items = downloaded
|
|
318
|
+
node.failed_items = failed
|
|
319
|
+
if downloaded == len(images):
|
|
320
|
+
node.status = NodeStatus.COMPLETED
|
|
321
|
+
elif downloaded > 0:
|
|
322
|
+
# Partial — keep DISCOVERED so it gets retried next run
|
|
323
|
+
node.status = NodeStatus.DISCOVERED
|
|
324
|
+
else:
|
|
325
|
+
node.status = NodeStatus.FAILED
|
|
326
|
+
|
|
327
|
+
return node
|
|
328
|
+
|
|
208
329
|
async def close(self):
|
|
209
330
|
"""Close HTTP session."""
|
|
210
331
|
if self._session and not self._session.closed:
|
|
@@ -32,10 +32,10 @@ class KyotoRMDAAdapter(BaseIIIFAdapter):
|
|
|
32
32
|
supports_iiif = True
|
|
33
33
|
supports_text = False
|
|
34
34
|
|
|
35
|
-
# IIIF
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
DEFAULT_IIIF_SIZE =
|
|
35
|
+
# RMDA serves IIIF Presentation 3.0; "max" is the canonical "original size"
|
|
36
|
+
# parameter (≈4 MB JPEG for typical pages). Use BOOKGET_KYOTO_IIIF_SIZE
|
|
37
|
+
# or BOOKGET_IIIF_SIZE env var to override (e.g. "2400," / "1600,").
|
|
38
|
+
DEFAULT_IIIF_SIZE = "max"
|
|
39
39
|
|
|
40
40
|
def extract_book_id(self, url: str) -> str:
|
|
41
41
|
"""
|
|
@@ -154,7 +154,7 @@ class KyotoRMDAAdapter(BaseIIIFAdapter):
|
|
|
154
154
|
"""
|
|
155
155
|
resources: List[Resource] = []
|
|
156
156
|
canvases = manifest.get("items", []) or []
|
|
157
|
-
size = self.
|
|
157
|
+
size = self.iiif_size
|
|
158
158
|
|
|
159
159
|
for idx, canvas in enumerate(canvases):
|
|
160
160
|
page_label = self._extract_label(canvas.get("label", "")) or str(idx + 1)
|
|
@@ -650,15 +650,24 @@ class ResourceManager:
|
|
|
650
650
|
'completed': completed,
|
|
651
651
|
'total': total,
|
|
652
652
|
})
|
|
653
|
+
# Scale per-node timeout by expected work: a base allowance
|
|
654
|
+
# plus 8s per item (covers slow IIIF tile servers and big
|
|
655
|
+
# original-size images). Hard cap to keep stuck nodes
|
|
656
|
+
# from blocking forever.
|
|
657
|
+
item_count = max(1, getattr(node, 'total_items', 0) or 1)
|
|
658
|
+
node_timeout = min(3600, max(180, 60 + item_count * 8))
|
|
653
659
|
try:
|
|
654
660
|
await asyncio.wait_for(
|
|
655
661
|
adapter.download_node(
|
|
656
662
|
book_id, node, node_dir, progress_callback=None),
|
|
657
|
-
timeout=
|
|
663
|
+
timeout=node_timeout,
|
|
658
664
|
)
|
|
659
665
|
success = node.status == NodeStatus.COMPLETED
|
|
660
666
|
except asyncio.TimeoutError:
|
|
661
|
-
logger.error(
|
|
667
|
+
logger.error(
|
|
668
|
+
f"Node {node.id} timed out after {node_timeout}s "
|
|
669
|
+
f"(downloaded {getattr(node, 'downloaded_items', 0)}"
|
|
670
|
+
f"/{item_count})")
|
|
662
671
|
node.status = NodeStatus.FAILED
|
|
663
672
|
success = False
|
|
664
673
|
except Exception as e:
|
|
@@ -13,6 +13,7 @@ Usage:
|
|
|
13
13
|
import argparse
|
|
14
14
|
import asyncio
|
|
15
15
|
import json
|
|
16
|
+
import os
|
|
16
17
|
import sys
|
|
17
18
|
from pathlib import Path
|
|
18
19
|
|
|
@@ -441,6 +442,19 @@ async def _interactive_mode():
|
|
|
441
442
|
except ValueError:
|
|
442
443
|
concurrency = 3
|
|
443
444
|
print(f" → 并行数:{concurrency}")
|
|
445
|
+
|
|
446
|
+
# --- Step 3b: IIIF image resolution (only for IIIF adapters) ---
|
|
447
|
+
if getattr(adapter, "supports_iiif", False):
|
|
448
|
+
print("\n选择图片分辨率:")
|
|
449
|
+
print(" 1) 最高清 (原始尺寸 max/full,文件最大)")
|
|
450
|
+
print(" 2) 高清 (2400px 宽)")
|
|
451
|
+
print(" 3) 阅读 (1600px 宽) ← 默认")
|
|
452
|
+
print(" 4) 缩略 (800px 宽)")
|
|
453
|
+
size_input = input("输入序号 [3]: ").strip() or "3"
|
|
454
|
+
size_map = {"1": "max", "2": "2400,", "3": "1600,", "4": "800,"}
|
|
455
|
+
chosen = size_map.get(size_input, "1600,")
|
|
456
|
+
os.environ["BOOKGET_IIIF_SIZE"] = chosen
|
|
457
|
+
print(f" → 分辨率:{chosen}")
|
|
444
458
|
print()
|
|
445
459
|
|
|
446
460
|
# --- Step 4: Discover ---
|
|
@@ -463,15 +477,33 @@ async def _interactive_mode():
|
|
|
463
477
|
print("\n开始下载……")
|
|
464
478
|
manager2 = ResourceManager(config)
|
|
465
479
|
try:
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
480
|
+
attempt = 1
|
|
481
|
+
while True:
|
|
482
|
+
manifest2 = await manager2.download_incremental(
|
|
483
|
+
url=url,
|
|
484
|
+
output_dir=output_dir,
|
|
485
|
+
concurrency=concurrency,
|
|
486
|
+
progress_callback=progress_bar,
|
|
487
|
+
)
|
|
488
|
+
print()
|
|
489
|
+
p = manifest2.get_progress()
|
|
490
|
+
failed = p.get('failed', 0)
|
|
491
|
+
print(
|
|
492
|
+
f"\n第 {attempt} 轮:{p['completed']}/{p['total']} 完成,"
|
|
493
|
+
f"{failed} 失败")
|
|
494
|
+
|
|
495
|
+
if failed == 0:
|
|
496
|
+
print(f"\n全部完成!输出目录:{output_dir}\n")
|
|
497
|
+
break
|
|
498
|
+
|
|
499
|
+
retry = input(
|
|
500
|
+
f"还有 {failed} 个节点失败,重试?[Y/n]: "
|
|
501
|
+
).strip().lower()
|
|
502
|
+
if retry in ("n", "no"):
|
|
503
|
+
print(f"\n保留 {failed} 个失败节点,下次跑同一 URL+目录可继续。\n")
|
|
504
|
+
break
|
|
505
|
+
attempt += 1
|
|
506
|
+
print(f"\n开始第 {attempt} 轮重试……")
|
|
475
507
|
except KeyboardInterrupt:
|
|
476
508
|
print("\n已中断。下次运行可从中断处继续。\n")
|
|
477
509
|
finally:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bookget
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Download and parse ancient Chinese book resources from digital libraries
|
|
5
5
|
Keywords: ancient-books,digital-library,downloader,classical-chinese
|
|
6
6
|
Classifier: Development Status :: 3 - Alpha
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|