Skip to content

SagesAi/ai_web_crawler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Web Crawler Project

Overview

This is a powerful web crawler designed to extract and process content from websites. It can:

  • Extract text content
  • Download images
  • Generate markdown files
  • Translate content
  • Create summaries

项目概述

这是一个功能强大的网页爬虫,用于从网站提取和处理内容。它可以:

  • 提取文本内容
  • 下载图片
  • 生成markdown文件
  • 翻译内容
  • 创建摘要

Key Features

  1. Content Extraction: Extracts text, images, and metadata from web pages
  2. Markdown Generation: Creates well-structured markdown files
  3. Translation: Automatically translates content to Chinese
  4. Summary Generation: Creates concise summaries of extracted content
  5. Image Handling: Downloads and organizes images
  6. Multi-page Support: Can process multiple URLs in sequence
  7. Error Handling: Robust error handling and logging

主要功能

  1. 内容提取: 从网页中提取文本、图片和元数据
  2. Markdown生成: 创建结构良好的markdown文件
  3. 翻译功能: 自动将内容翻译成中文
  4. 摘要生成: 创建提取内容的简明摘要
  5. 图片处理: 下载并组织图片
  6. 多页面支持: 可以顺序处理多个URL
  7. 错误处理: 强大的错误处理和日志记录

Usage

  1. Run the script: python3 web_crawler.py
  2. Enter the URL you want to crawl
  3. View results in the generated folder

使用方法

  1. 运行脚本: python3 web_crawler.py
  2. 输入要爬取的URL
  3. 在生成的文件夹中查看结果

Technical Details

  • Built with Python 3
  • Uses BeautifulSoup for HTML parsing
  • Leverages OpenAI API for translation and summarization
  • Handles various content types and structures

技术细节

  • 基于Python 3构建
  • 使用BeautifulSoup进行HTML解析
  • 利用OpenAI API进行翻译和摘要生成
  • 处理各种内容类型和结构

Requirements

  • Python 3.x
  • BeautifulSoup4
  • requests
  • openai

需求

  • Python 3.x
  • BeautifulSoup4
  • requests
  • openai

Output Structure

Each crawled website creates a folder containing:

  • output.md: Original content
  • output_translated.md: Translated content
  • summary.md: Generated summary
  • images/: Downloaded images

输出结构

每个爬取的网站会创建一个包含以下内容的文件夹:

  • output.md: 原始内容
  • output_translated.md: 翻译后的内容
  • summary.md: 生成的摘要
  • images/: 下载的图片

Translation Capabilities

  • Automatic English to Chinese translation
  • Preserves original formatting
  • Handles technical terms accurately

翻译功能

  • 自动英译中
  • 保留原始格式
  • 准确处理技术术语

Image Handling

  • Downloads all images from the page
  • Organizes them in an images folder

图片处理

  • 下载页面中的所有图片
  • 将它们组织在images文件夹中
  • 在markdown中使用正确的语法保留图片引用: ![描述](images/image_1.jpg)

Summary Generation

  • Creates concise summaries of main content
  • Highlights key points
  • Preserves important technical details

摘要生成

  • 创建主要内容的简明摘要
  • 突出关键点
  • 保留重要的技术细节

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages