NIUBOYI»Home › › Explore AI, Master AI › 中文 | English
微信扫一扫 分享朋友圈

已有 2030 人浏览分享

了解AI 玩转AI    Data Scraping Tool: Gpt-crawler, a General-Purpose Copy Crawler for Scraping Data from Websites—Installation and Usage Tutorial, a Beginner-Friendly Tool

2024-4-2 16:28:432030 0
A crawler is essential software for every AI enthusiast. No matter what kind of AI you work on, you cannot do without data. Gpt-crawler is highly recommended by the moderator and is beginner-friendly. Installation is simple; you only need to spend about 10-plus minutes before you can start your crawling tasks. Let's begin today's tutorial.

[baike]Install NOde.JS[/baike]Open the official Node website, https://nodejs.org/en. Click Download; after downloading, just click Next, Next.

微信截图_20240402210140.png

[baike]Install Gpt-crawler[/baike]On the computer drive where you want to install it, create a folder, for example name it Gpt-crawler, then type CMD in the folder's path/address bar.

微信截图_20240402210335.png

Enter the installation command to install the main program: git clone https://github.com/builderio/gpt-crawler

微信截图_20240402210436.png

After installation, enter this folder and type cd gpt-crawler

微信截图_20240402210956.png

After entering this folder, enter the dependency installation command: npm i  
At this point, installation is complete.

[baike]Configure the crawling file[/baike]
In the main program folder, click config.ts and open it with Notepad or any editing software.

微信截图_20240402211709.png

To make it beginner-friendly, I opened it with Notepad so it is clearer. In it, I have already written the necessary parameters and the corresponding Chinese explanations. These configurations represent the URL we crawl and what the crawled content includes.

微信截图_20240402211944.png
I have put the code here; you can copy it if needed.
import { Config } from "./src/config";


export const defaultConfig: Config = {
  url: "https://www.niuboyi.com/thread-222-1-1.html",
  /** URL to start crawling from; if a sitemap is provided, it will be used and all pages in the sitemap will be downloaded */
  match: "https://www.niuboyi.com/thread-222-1-1.html",
  /** Selector to get the inner text from */
  selector: `.docs-builder-container`,
  /** Content tags to crawl */
  maxPagesToCrawl: 50,
  /** Do not crawl more than this number of pages */
  outputFileName: "output.json",
  /** Output name */
  maxTokens: 2000000,
  /** Word count */
};


After configuration, enter the command npm start and press Enter to start crawling.
微信截图_20240402212213.png

The crawled files are all in the output-1.json file in the directory. When this file has enough content, it can become your knowledge base.

微信截图_20240402212712.png

[baike]Use the knowledge base to create a custom GPTS[/baike]

Open the GPTs creation page, https://chat.openai.com/gpts/editor

微信截图_20240402213140.png

At this point, you now have your own crawler and can crawl the vast majority of websites
  • WeChat Official Account

  • Scan to Visit Mobile Site

QQ|NIUBOYI ( 京ICP备17025393号 )|网站地图

GMT+8, 2026-10-30 19:46 , Processed in 0.491054 second(s), 40 queries .

POWERED BY NIUBOYIAI! 主理人:NIUBOYIAI  点亮哥

Copyright © 2001-2020, NIUBOYI AI.