crawler: --no-cover, --concurrency, drop cross-host sleep + batch-50 Step 1 done

Three crawler ergonomics for batch operations:

--no-cover  Skip cover image download. For scan-only modes (license/meta
            scrape) this drops ~1.3s/project and avoids slow-CDN hangs.

--concurrency N  ThreadPoolExecutor wrapping the per-project loop. Default
                 1 = serial (current behavior). Anonymous endpoints tolerate
                 5+ comfortably; output uses a print lock for readable
                 interleaved progress. fetch_cover plumbs through crawl_one.

Drop cross-host sleep #1: in crawl_one between detail HTML (oshwhub.com)
and cover image (image.lceda.cn). Different hosts — sleep was unnecessary.
Saves ~1s/project. Sleep #2 (post-cover, before next iteration) stays — it
gates the next oshwhub.com hit.

download_to gains max_seconds wall budget (default 60s, cover uses 15s).
Defends against pathologically slow CDN connections — observed 10 KB/s
on image.lceda.cn for one project, would have hung 6+ min on a 3.6 MB
cover otherwise. httpx default timeout resets per chunk, so streaming
downloads need an external wall-clock guard.

batch-50 Step 1 (license/meta scrape) shipped:
  50/50 candidates have metadata.json + license recorded
  License distribution: GPL 3.0 32, Public Domain 6, NC variants 8,
                        CERN-OHL 1, MIT 1, CC BY 3.0 1
  Forge-friendly (non-NC): 41/50 (82%)
  Declared attachments: 180 files / 2.36 GB (median 18 MB/proj, max 304 MB)
  Walltime: 3min 26s for 28 projects at concurrency=5 (server-side
            HTML render bound, not sleep-bound)

One orphan partial cover (a670e60a...) cleaned up — leftover from the
first aborted run before the timeout fix landed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-29 01:35:11 +08:00
parent fe6971f3f9
commit c6fd111d6d
171 changed files with 5410 additions and 17 deletions

View File

@@ -0,0 +1,50 @@
{
"source": "oshwhub",
"source_url": "https://oshwhub.com/pengzhihui/b11afae464c54a3e8d0f77e1f92dc7b7",
"project_id": "c4aad9461c3941228a784944eb500757",
"title": "【瀚文】HelloWord-Keyboard",
"description_short": "`瀚文` 智能键盘是一把我为自己使用需求设计的 多功能、模块化 机械键盘。",
"description_path": "description.md",
"author": {
"username": "pengzhihui",
"display_name": "pengzhihui",
"user_id": "07d6c15e714c4f6aaba8aa0c3737379e"
},
"license": "Public Domain",
"tags": [],
"created_at": "2022-08-20T04:18:00.000Z",
"updated_at": "2026-02-24T03:18:19.000Z",
"published_at": "2023-08-28T08:11:34.000Z",
"crawled_at": "2026-04-28T16:59:27.468281+00:00",
"metrics": {
"likes": 2137,
"stars": 3157,
"forks": 0,
"views": 329510,
"watch": 0,
"comments": 586
},
"cover": {
"url": "https://image.lceda.cn/pullimage/3X5wPID5TfY2QATyzcLAeXExhakaDHZSGnFrsTC3.jpeg",
"path": "cover.jpeg"
},
"files": [
{
"name": "瀚文STP模型.7z",
"url": "https://image.lceda.cn/attachments/2022/8/ymzbvVGW5gVYow3Zp29ofyCWiZ3Mly9F4Iof0aOF.7z",
"original_id": "6c3a994aa9d74e56857a7473ca72d739",
"ext": "7z",
"mime": "application/octet-stream",
"size": 1491857,
"md5": "4da42154a6165860eafeca77b5d4f66e"
}
],
"raw_fields": {
"path": "pengzhihui/b11afae464c54a3e8d0f77e1f92dc7b7",
"grade": 4,
"origin": "pro",
"public": true,
"publish": true,
"skipped_files": []
}
}