smart-image-scraper-mcp 2.13.0 → 2.13.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-image-scraper-mcp",
3
- "version": "2.13.0",
3
+ "version": "2.13.1",
4
4
  "description": "全网智能图片抓取 MCP 服务器 - 支持 Bing/Google 图片搜索、验证和下载",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -481,27 +481,21 @@ export class Orchestrator {
481
481
 
482
482
  if (signal?.aborted) throw new Error('操作已取消');
483
483
 
484
- // 防盗链过滤(用于链接列表展示)
485
- let linkUrls = rawUrls;
486
- let hotlinkCount = 0;
487
- if (shouldFilterHotlink) {
488
- linkUrls = rawUrls.filter(url => !this.linkValidator.isHotlinkProtected(url));
489
- hotlinkCount = rawUrls.length - linkUrls.length;
490
- if (hotlinkCount > 0) {
491
- logger.warn(`[HOTLINK] "${keyword}" - filtered ${hotlinkCount} hotlink-protected URLs`);
492
- }
493
- }
494
-
495
- // 验证链接
496
- let validatedUrls;
484
+ // both 模式:对所有原始 URL 统一验证一次,然后分别用于链接展示和下载
485
+ let allValidUrls; // 所有验证通过的 URL
486
+ let validatedUrls; // 链接列表(可能过滤防盗链)
487
+ let downloadUrls; // 下载列表(不过滤防盗链,下载时加 Referer)
497
488
  let qualityModeLabel;
489
+ let hotlinkCount = 0;
498
490
 
499
491
  if (fastMode) {
500
- validatedUrls = linkUrls.slice(0, count);
492
+ // fast 模式:不验证
493
+ allValidUrls = rawUrls.slice(0, count * 2 + 5);
501
494
  qualityModeLabel = '快速模式(跳过验证)';
502
495
  } else {
503
- const maxValidate = Math.min(linkUrls.length, count * 2 + 5);
504
- const urlsToValidate = linkUrls.slice(0, maxValidate);
496
+ // balanced/high 模式:统一验证所有原始 URL
497
+ const maxValidate = Math.min(rawUrls.length, count * 2 + 5);
498
+ const urlsToValidate = rawUrls.slice(0, maxValidate);
505
499
  const { valid } = await this.linkValidator.validateMany(urlsToValidate, {
506
500
  fetchQuality: prioritizeQuality,
507
501
  sortByQuality: prioritizeQuality,
@@ -517,14 +511,27 @@ export class Orchestrator {
517
511
  });
518
512
  }
519
513
 
520
- validatedUrls = filteredValid.slice(0, count).map(v => v.url);
514
+ allValidUrls = filteredValid.map(v => v.url);
521
515
  qualityModeLabel = prioritizeQuality ? '高质量模式(验证+排序)' : '平衡模式(验证)';
522
516
  }
523
517
 
518
+ // 链接列表:根据 filterHotlink 参数决定是否过滤防盗链
519
+ if (shouldFilterHotlink) {
520
+ const filtered = allValidUrls.filter(url => !this.linkValidator.isHotlinkProtected(url));
521
+ hotlinkCount = allValidUrls.length - filtered.length;
522
+ validatedUrls = filtered.slice(0, count);
523
+ if (hotlinkCount > 0) {
524
+ logger.warn(`[HOTLINK] "${keyword}" - filtered ${hotlinkCount} hotlink-protected URLs from links`);
525
+ }
526
+ } else {
527
+ validatedUrls = allValidUrls.slice(0, count);
528
+ }
529
+
530
+ // 下载列表:使用所有验证通过的 URL(不过滤防盗链,下载时加 Referer 绕过)
531
+ downloadUrls = allValidUrls.slice(0, count * 2);
532
+
524
533
  if (signal?.aborted) throw new Error('操作已取消');
525
534
 
526
- // 下载图片(使用所有原始 URL,不受防盗链过滤影响,因为下载时会加 Referer)
527
- const downloadUrls = fastMode ? rawUrls.slice(0, count * 2 + 5) : validatedUrls;
528
535
  const { success, failed } = await this.fileManager.downloadMany(downloadUrls, keyword);
529
536
 
530
537
  let resultDownloads = success.slice(0, count);