Skip to main content

Explore, search, and download ebooks programmatically or via CLI

Project description

pdfdrive-api

Unofficial Python wrapper for pdfdrive.com.co

PyPI version PyPI - Python Version Coverage PyPI - License Downloads Ruff

Features

  • Search ebooks with optional filters (tag, category, etc.)
  • Explore books by categories or homepage
  • Download ebooks asynchronously with high speed
  • Full CLI support for interactive and automated usage
  • Easy integration in scripts and applications

Installation

$ uv pip install "pdfdrive-api[cli]"

Developer Usage

Download by URL

from pdfdrive_api import BookDetails, Downloader

book_details = BookDetails(
    "https://pdfdrive.com.co/rich-dad-poor-dad-pdf/"
)

downloader = Downloader()

async def download_book():
    details = await book_details.get_details(for_download=True)
    download_url = details.book.download_url

    downloaded_file = await downloader.run(
        download_url,
        test=False,
        suppress_incompatible_error=True
    )

    print(downloaded_file)


if __name__ == "__main__":
    import asyncio
    asyncio.run(download_book())

Search and Download

from pdfdrive_api import BookDetails, Downloader, SearchPage

async def main():
    search = SearchPage("Rich dad")
    resp = await search.get_content()
    target_book = resp.books.books[0]

    book_details = await BookDetails(target_book.url).get_details(for_download=True)
    downloader = Downloader()

    downloaded_file = await downloader.run(
        book_details.download_url,
        suppress_incompatible_error=True,
        test=True
    )

    print(downloaded_file)

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Command Line Interface (CLI)

The package installs a CLI tool called pdfdrive for quick searching, exploring, and downloading ebooks.

pdfdrive --help
Usage: pdfdrive COMMAND

Explore, search and download ebooks from pdfdrive.com.co

Commands:
  download      Download ebook by specifying its title or page URL
  explore       Explore available ebooks by different criteria
  search        Search for a particular book by its title
  --help, -h    Display this message and exit
  --version, -v Display application version

pdfdrive download

pdfdrive download QUERY [ARGS]

Download an ebook by title or by its page URL.

Parameter Aliases Description Default
QUERY --query Search text or book page URL. Required
--dir -d Directory to save downloaded files. [current working directory]
--filename -f Custom filename for output file. Auto-generated
--connections Number of parallel download connections. 5
--yes, -y Proceed with the first search result automatically. False
--quiet, -q Auto-download book whose title matches the query exactly. False

Examples:

# Download a book interactively
pdfdrive download "The Pragmatic Programmer"

# Auto-download first result
pdfdrive download "Clean Code" -y

# Download by URL
pdfdrive download "https://pdfdrive.com.co/book/clean-code-pdf/"

# Custom directory and filename
pdfdrive download "Deep Learning with Python" -d ~/Downloads -f deeplearning.pdf

pdfdrive explore

pdfdrive explore [ARGS]

Explore ebooks by category, tag, search query, or directly from a listing URL.

Parameters

Parameter Aliases Description Default
--offset -o Page number to start from.
--confirm, --no-confirm -c Ask before going to the next page. False
--details, --no-details -d Display detailed book info. False
--limit -l Number of pages to explore. 10
--infinity -i Explore indefinitely without page limit. False
--search -s Explore by a text query.
--category -c Explore a category. Choices include: astrology, biography, academic-and-education, business-and-career, health, novels, self-improvement, religion, etc.
--name -n Explore books with a particular tag.
--url -u Explore books from a specific listing URL.
--homepage, -home Explore homepage content. True

Examples:

# Explore homepage
pdfdrive explore

# Explore 5 pages in 'business-and-career' category
pdfdrive explore -c business-and-career -l 5

# Explore books tagged "machine learning"
pdfdrive explore -t "machine learning"

# Explore using URL
pdfdrive explore --u "https://pdfdrive.com.co/category/academic-and-education"

# Infinite exploration, auto-advance
pdfdrive explore -i

pdfdrive search

pdfdrive search QUERY [ARGS]

Search for a book by title. Optionally select, auto-proceed, or download directly.

Parameter Aliases Description Default
QUERY --query Search text. Required
--limit -l Number of result pages to scan. 1
--yes, -y Automatically select the first book found. False
--select-one -s Prompt user to select a book from results. Manual
--quiet -q Automatically proceed if exact title match is found.

Examples:

# Search for a book interactively
pdfdrive search "Rich Dad Poor Dad"

# Auto-select first search result
pdfdrive search "Clean Architecture" -y

# Prompt to choose a book
pdfdrive search "Deep Learning" -s

# Quiet mode – exact title match
pdfdrive search "Atomic Habits" -q

# Search across 3 pages
pdfdrive search "Artificial Intelligence" -l 3

Summary

Command Description
pdfdrive download Download an ebook by title or URL
pdfdrive explore Explore ebooks by category, tag, or query
pdfdrive search Search for a particular book by title

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

pdfdrive_api-0.1.2.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

pdfdrive_api-0.1.2-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file pdfdrive_api-0.1.2.tar.gz.

File metadata

  • Download URL: pdfdrive_api-0.1.2.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for pdfdrive_api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 59f906c09262a4cb0d8cd615c11911030ab28f69e2da79c1cea2f95c3e964c7b
MD5 726cfa8509e56f8192039b536d0cbfef
BLAKE2b-256 1ef5ae422a674aa9fc4885cba0bbaac5796278251074e0805a10332ab5b168f9

See more details on using hashes here.

File details

Details for the file pdfdrive_api-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pdfdrive_api-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee794910fcdade2e729d2fc0560c6799a4dc2233499d26160ec60071727ef2d7
MD5 1217826a7c582afe68c8dca8069d8d3f
BLAKE2b-256 8c1e6e7a1cce2dfd1796a84929f58237e00388c50941c928a1237eba442229f5

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