# 定时器

了解如何自动启动 Web Scraper API 任务，以及 Cron 表达式的基础知识。

您可以通过 Thordata 仪表板设置和管理您的任务计划，指定 Web Scraper API 在特定时间或按照特定规则自动运行。使用 Cron 表达式，您可以灵活地安排任务的运行频率。

{% hint style="info" %}
注意： 在大多数情况下，定时任务会在预定时间的一秒内触发，但是由于系统或者服务器原因，任务可能会有轻微延迟。
{% endhint %}

**设置新的定时任务**

进入定时器： 首先您需要先进入“定时器”页面，然后点击页面有左上角 \[创建定时任务] 按钮，即可进入设置定时任务页面。

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

配置定时任务：

1. 定时任务名称：您可以自定义计划任务的名称，以便更容易进行管理。
2. 定时设置：定时计划设置工具使用 Cron 表达式来指定运行时间。如果您熟悉如何使用 Cron 表达式，可以直接开始使用。如果您不熟悉 Cron 表达式，也不用担心——该设置工具提供了一个可视化的自定义配置页面，包括按分钟、小时、天、周或月设置的工具。它提供了与 Cron 表达式类似的调度功能，尽管功能不如 Cron 表达式强大，但您仍然可以直接自定义并设置定时计划。
3. 选择抓取 API ：选择目标抓取 API 并配置要抓取的内容。
4. 最后点击 \[确定] 即可。

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

**Cron**&#x20;

标准 Cron 表达式（5 位）用于指定任务的执行时间，表达式格式为：分钟 小时 天 月份 星期，共由五个字段组成。

参数：&#x20;

<table><thead><tr><th width="85">位数</th><th width="88">名称</th><th width="300">取值范围</th><th></th></tr></thead><tbody><tr><td>1</td><td>分钟</td><td>0-59</td><td>每小时的第几分钟</td></tr><tr><td>2</td><td>小时</td><td>0-23</td><td>每天的第几小时</td></tr><tr><td>3</td><td>日</td><td>1-31或者？</td><td>每月的第几天</td></tr><tr><td>4</td><td>月</td><td>1-12</td><td>每年的第几月</td></tr><tr><td>5</td><td>星期</td><td>0-7（0和7都代表星期天）或者？</td><td>每周的星期几</td></tr></tbody></table>

例如：0 8 \* \* 1-5&#x20;

表示：在每个周一到周五的每天早上 8 点整执行抓取任务。


---

# Agent Instructions: 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://doc.thordata.com/doc/zh/web-scraper-api/ding-shi-qi.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.
