> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 网页爬取与自动化

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<div id="overview">
  ## 概览
</div>

Devin 是你勤勉高效的网页爬取助手。它既可以为你构建网页爬虫，也可以自主完成重复性的网页调研和信息采集任务！

<div id="use-cases">
  ## 使用场景
</div>

1. 网页抓取与数据收集
2. 自动化数据提取
3. 将抓取的数据转换为结构化格式
4. 处理静态和动态 Web 内容
5. 用于执行重复任务的浏览器自动化
6. 使用 [API Reference](/zh/api-reference/overview) 构建自动化数据采集流水线

<div id="example-prompts">
  ## 示例提示
</div>

<AccordionGroup>
  <Accordion title="抓取表情符号" icon="face-smile">
    <PromptBlock>
      ```txt Scrape emojis theme={null}
      使用此仓库 (https://github.com/muan/unicode-emoji-json) 编写一个函数，将类似 https://www.gstatic.com/android/keyboard/emojikitchen/20201001/u1f600/u1f600_u2615.png 的字符串转换为 "grinning_face_warm_beverage"：方法是提取其中的 2 个表情符号 (u1f600, u2615)，并将它们转换为实际的表情符号。
      ```
    </PromptBlock>
  </Accordion>

  <Accordion title="使用客户端和服务端脚本进行抓取" icon="shovel-snow">
    <PromptBlock>
      ```txt Scrape website theme={null}
      ## 概览
      此操作手册可用于抓取一个网站，并将结果返回给用户，同时提供用于生成这些结果的客户端和服务端抓取脚本。
      ```
    </PromptBlock>
  </Accordion>

  <Accordion title="重复性的网页任务" icon="globe">
    <PromptBlock>
      ```txt Download logos theme={null}
      请查找并下载 50 家《财富》500 强企业的 logo。
      ```
    </PromptBlock>
  </Accordion>
</AccordionGroup>

<div id="example-sessions">
  ## 示例会话
</div>

<div id="emoji-data-processing">
  ### Emoji 数据处理
</div>

**抓取 Emoji**

了解如何从 GitHub 仓库中解析并转换 emoji 的 Unicode 数据为人类可读的格式。本节演示如何使用 JSON 数据源和字符串操作来完成 emoji 处理。

[https://app.devin.ai/sessions/4f8a7b129820493b9c0ca140cddede50](https://app.devin.ai/sessions/4f8a7b129820493b9c0ca140cddede50)

<div id="youtube-content-extraction">
  ### YouTube 内容提取
</div>

**抓取 YouTube 播放列表**

了解如何以编程方式从 YouTube 播放列表中提取视频元数据。本节介绍如何使用 Python 获取视频标题、描述以及播放列表中的其他信息，同时遵守 YouTube 的服务条款。

[https://app.devin.ai/sessions/8c6edbbb0bce4b70acd09255e1994c0b](https://app.devin.ai/sessions/8c6edbbb0bce4b70acd09255e1994c0b)

<div id="e-commerce-data-collection">
  ### 电商数据采集
</div>

**抓取 eBay 数据**

学习如何大规模收集 eBay 商品信息的技术。本会话将介绍自动化网页爬取方法，用于采集商品价格、描述和卖家信息，并说明在此过程中如何处理分页和请求速率限制。

[https://app.devin.ai/sessions/dc70fe0649cb4041852da384e65d42be](https://app.devin.ai/sessions/dc70fe0649cb4041852da384e65d42be)
