> For the complete documentation index, see [llms.txt](https://help.pichound.app/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.pichound.app/zh/shi-yong-zhi-nan/zhi-neng-jiao-ben.md).

# 智能脚本

### 界面显示

<div align="left"><figure><img src="/files/pRJNg6TAjTkH3INMynq8" alt="" width="355"><figcaption></figcaption></figure></div>

### 示例脚本

访问 「青创网」 的某店铺，通过配置脚本把相关图片进行分组

<div align="left"><figure><img src="/files/3OOoUvMSa520uxtPMAAq" alt="" width="563"><figcaption></figcaption></figure></div>

也支持批量下载的时候进行分组命名

<div align="left"><figure><img src="/files/1DFBtAAJqbhgIlzGb8ju" alt="" width="350"><figcaption></figcaption></figure></div>

### 脚本规则

上面例子的脚本如下：

{% code overflow="wrap" lineNumbers="true" %}

```json
{
  "id": 10088,
  "name": "青创网",
  "ico": "https://assets.pichound.app/17qcc.com.ico",
  "version": "1.0.0",
  "description": "下载青创网商品图片，需要滚动加载到详情图片才可以下载详情图片",
  "reg": "17qcc.com",
  "status": "prod",
  "tags": [
    "ec"
  ],
  "examples": [
    "https://www.17qcc.com/item/3955701.html"
  ],
  "groups": [
    {
      "fn": "updateGroupByIds",
      "props": {
        "groupName": "主图",
        "groupIndex": 0,
        "ids": [
          {
            "id": ".prodcut_img .ul_box img",
            "attributes": [
              "dataset.lazyload",
              "src"
            ],
            "replaceUrlRules": [
              {
                "pattern": "\\?.*$",
                "replaceValue": ""
              }
            ]
          }
        ]
      }
    },
    {
      "fn": "updateGroupByIds",
      "props": {
        "groupName": "SKU图片",
        "groupIndex": 1,
        "ids": [
          {
            "id": ".skuinfo .pro_color img",
            "attributes": [
              "src"
            ],
            "replaceUrlRules": [
              {
                "pattern": "\\?.*$",
                "replaceValue": ""
              }
            ]
          }
        ]
      }
    },
    {
      "fn": "updateGroupByIds",
      "props": {
        "groupName": "详情",
        "groupIndex": 2,
        "ids": [
          {
            "id": ".pro_detail .pro_img img",
            "attributes": [
              "dataset.lazyload",
              "src"
            ],
            "replaceUrlRules": [
              {
                "pattern": "\\?.*$",
                "replaceValue": ""
              }
            ]
          }
        ]
      }
    },
    {
      "fn": "updateGroupByIds",
      "props": {
        "groupName": "视频",
        "groupIndex": 3,
        "ids": [
          {
            "id": "#J_playVideo",
            "attributes": [
              "videourl"
            ],
            "type": "VIDEO"
          }
        ]
      }
    }
  ]
}
```

{% endcode %}

#### API

```typescript
export interface IGroupConfig {
  // 唯一 ID
  id: number;
  // 插件名
  name: string;
  // 插件icon
  ico?: string;
  // 插件版本
  version?: string;
  // 插件描述
  description?: string;
  // 默认匹配路径
  reg: string;
  // 插件分组功能
  groups: IRun[];
  // 发布状态
  status?: string;
  // 例子
  examples?: string[];
}

export interface IRun {
  // 函数能力
  fn: string;
  // 额外传参
  props: IRunProps;
}

export interface IIds {
  // 参数 Ids
  id: string;
  // 参数路径
  attributes?: string[];
  // 类型, 有可能是视频类型
  type?: string;
  // 图片描述信息
  alt?: string;
  // 替换图片规则
  replaceUrlRules?: IReplaceUrlRule[];
  // 过滤图片规则
  filterUrlRules?: IReplaceUrlRule[];
}

export interface IReplaceUrlRule {
  pattern: string
  flags?: string
  replaceValue?: string
}

export interface IRunProps {
  // 来源对象 默认是 document.querySelectorAll, 返回可迭代数组
  source?: string;
  // 参数 Ids
  ids: IIds[];
  // 分组名
  groupName: string;
  // 分组索引
  groupIndex: number;
}
```

### 脚本定制

如需定制特殊网站，请联系

{% content-ref url="/pages/Y3YxtXcf6E89MvfEcE3Q" %}
[在线支持](/zh/guan-yu-wo-men/zai-xian-zhi-chi.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.pichound.app/zh/shi-yong-zhi-nan/zhi-neng-jiao-ben.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
