Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gazpacho

> 编程语言
Open source

The simple, fast, and modern web scraping library

768 stars0 likes0 views
WebsiteGitHub

About

The simple, fast, and modern web scraping library

About

gazpacho is a simple, fast, and modern web scraping library. The library is stable, and installed with zero dependencies.

Install

Install with pip at the command line:

bash
pip install -U gazpacho

Quickstart

Give this a try:

python
from gazpacho import get, Soup

url = 'https://scrape.world/books'
html = get(url)
soup = Soup(html)
books = soup.find('div', {'class': 'book-'}, partial=True)

def parse(book):
    name = book.find('h4').text
    price = float(book.find('p').text[1:].split(' ')[0])
    return name, price

[parse(book) for book in books]

Tutorial

Import

Import gazpacho following the convention:

python
from gazpacho import get, Soup

get

Use the get function to download raw HTML:

python
url = 'https://scrape.world/soup'
html = get(url)
print(html[:50])
# '\n\n  \n    <met'

Adjust get requests with optional params and headers:

python
get(
    url='https://httpbin.org/anything',
    params={'foo': 'bar', 'bar': 'baz'},
    headers={'User-Agent': 'gazpacho'}
)

Soup

Use the Soup wrapper on raw html to enable parsing:

python
soup = Soup(html)

Soup objects can alternatively be initialized with the .get classmethod:

python
soup = Soup.get(url)

.find

Use the .find method to target and extract HTML tags:

python
h1 = soup.find('h1')
print(h1)
# 
Soup

attrs=

Use the attrs argument to isolate tags that contain specific HTML element attributes:

python
soup.find('div', attrs={'class': 'section-'})

partial=

Element attributes are partially matched by default. Turn this off by setting partial to False:

python
soup.find('div', {'class': 'soup'}, partial=False)

mode=

Override the mode argument {'auto', 'first', 'all'} to guarantee return behaviour:

python
print(soup.find('span', mode='first'))
# 
len(soup.find('span', mode='all'))
# 8

dir()

Soup objects have html, tag, attrs, and text attributes:

python
dir(h1)
# ['attrs', 'find', 'get', 'html', 'strip', 'tag', 'text']

Use them accordingly:

python
print(h1.html)
# '
Soup
'
print(h1.tag)
# h1
print(h1.attrs)
# {'id': 'firstHeading', 'class': 'firstHeading', 'lang': 'en'}
print(h1.text)
# Soup

Support

If you use gazpacho, consider adding the badge to your project README.md:

markdown

Contribute

For feature requests or bug reports, please use Github Issues

For PRs, please read the CONTRIBUTING.md document

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言