Skip to main content

一个强大的Google图片爬虫工具

Project description

GlimCrawl

PyPI version Python Version License

English | 简体中文

一个强大的 Google 图片爬虫工具,支持批量下载、图片处理和代理设置。名称来源:glimpse(一瞥)+ crawl(爬行),强调"快速捕捉网络图片片段"。

✨ 特性

  • 🚀 异步并发下载,提高效率
  • 🎨 自动图片处理和优化(去水印、调整大小等)
  • 🌐 支持代理设置,解决网络问题
  • 📏 支持图片尺寸和时间筛选
  • 🖥️ 命令行界面,易于使用
  • 📦 支持作为 Python 库导入使用
  • 🔒 安全可靠,遵循 Google 搜索规范

📦 安装

# 从 PyPI 安装(推荐)
pip install glimcrawl

# 安装 Playwright 浏览器(必需)
playwright install chromium

🚀 快速开始

命令行使用

# 基本使用
glimcrawl download "猫咪"

# 指定下载数量和保存目录
glimcrawl download "猫咪" -n 50 -d ./images

# 使用代理
glimcrawl download "猫咪" -p http://127.0.0.1:1080

# 筛选大图和最近图片
glimcrawl download "猫咪" -s l -t w

Python 库使用

import asyncio
from glimcrawl import GoogleImageCrawler
from playwright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        crawler = GoogleImageCrawler(browser)
        # 下载 20 张猫咪图片到 images 目录
        await crawler.crawl_images("猫咪", max_images=20, save_dir="images")
        await browser.close()

asyncio.run(main())

📝 参数说明

命令行参数

参数 说明 默认值 示例
keyword 搜索关键词(必需) - "猫咪"
-n, --max-images 最大下载数量 20 -n 50
-d, --save-dir 保存目录 downloaded_images -d ./images
-p, --proxy 代理服务器 None -p http://127.0.0.1:1080
-s, --size 图片尺寸 None -s l (大图)
-t, --date 时间范围 None -t w (一周内)

图片尺寸选项

  • l: 大图
  • m: 中图
  • i: 图标

时间范围选项

  • d: 24小时内
  • w: 一周内
  • m: 一月内
  • y: 一年内

🛠️ 图片处理

下载的图片会自动进行以下处理:

  1. 格式转换:统一转为 JPG 格式
  2. 尺寸调整:最大 1920x1080,保持比例
  3. 质量优化:85% 压缩率
  4. 文件命名:使用 MD5 哈希,避免重复
  5. 去水印:自动识别和移除水印(实验性功能)

🔒 安全建议

  1. 使用代理时建议配置 HTTPS 代理
  2. 遵循目标网站的爬虫规范
  3. 合理设置下载间隔和并发数
  4. 图片仅供学习研究使用

🤝 贡献

  1. Fork 本仓库
  2. 创建新分支: git checkout -b feat/new-feature
  3. 提交更改: git commit -am 'feat: add new feature'
  4. 推送分支: git push origin feat/new-feature
  5. 提交 Pull Request

📄 许可证

MIT License © 2024 Duckweeds7

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glimcrawl-0.1.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glimcrawl-0.1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file glimcrawl-0.1.0.tar.gz.

File metadata

  • Download URL: glimcrawl-0.1.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for glimcrawl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f7289a4ec65e2a0413f0885566d43cf39829206749cb48315050a0936899c0bf
MD5 a0efbbc376fe257ce49a7fc135f4f081
BLAKE2b-256 93f9febe3648be8b865101df2aaeaadf7e27807f3fec066e3d7c9e2d7fb17599

See more details on using hashes here.

File details

Details for the file glimcrawl-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: glimcrawl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for glimcrawl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f19ce5350a6d76d06ac0fd301db4bbcc3212b4f899eb3c024a8a5c102ff4d60a
MD5 c4e41ba73bebc2711b1ea291f7acf6ca
BLAKE2b-256 771341ebaa6c0511f524bf4bd91bf82b4f9143151242944af2dec6b89fcba6c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page