Skip to main content

A tool for expanding Danbooru tags with their implications and aliases

Project description

Danbooru Tag Expander

A Python tool for expanding Danbooru tags with their implications and aliases. This tool helps you get a complete set of related tags when working with Danbooru's tagging system.

Features

  • Expand tags with their implications and aliases
  • Support for both command-line and programmatic usage
  • Configurable output formats (text, JSON, CSV)
  • Progress tracking and detailed logging
  • Caching support for better performance

Installation

You can install the package using pip:

pip install danbooru-tag-expander

Usage

Command Line

# Basic usage with tags
danbooru-tag-expander --tags "1girl" "solo"

# Using a file containing tags
danbooru-tag-expander --file tags.txt

# Output in different formats
danbooru-tag-expander --tags "1girl" --format json
danbooru-tag-expander --tags "1girl" --format csv

# Control logging verbosity
danbooru-tag-expander --tags "1girl" --quiet
danbooru-tag-expander --tags "1girl" --log-level DEBUG

Python API

from danbooru_tag_expander.tag_expander import TagExpander

# Create an expander instance
expander = TagExpander(
    username="your-username",  # Optional, can be set via environment
    api_key="your-api-key",    # Optional, can be set via environment
    use_cache=True             # Enable caching for better performance
)

# Expand tags
expanded_tags, frequencies = expander.expand_tags(["1girl", "solo"])

# Print results
print(f"Original tags: 1girl, solo")
print(f"Expanded tags: {', '.join(expanded_tags)}")

Configuration

The tool can be configured using environment variables or command-line arguments:

  • DANBOORU_USERNAME: Your Danbooru username
  • DANBOORU_API_KEY: Your Danbooru API key
  • DANBOORU_SITE_URL: Custom Danbooru instance URL (optional)
  • DANBOORU_CACHE_DIR: Custom cache directory location (optional)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

danbooru-tag-expander-0.1.2.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

danbooru_tag_expander-0.1.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file danbooru-tag-expander-0.1.2.tar.gz.

File metadata

  • Download URL: danbooru-tag-expander-0.1.2.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for danbooru-tag-expander-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f97036913f0a7b6331f33110239ca22384099dd70c6aedcadd315c8a6d800f98
MD5 6f089d3f052032cf2d22a6d114de36f1
BLAKE2b-256 b9ce3e10a23e6dc0ea2e06040c1363a699d5d785f77c942d958ada770a083a4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for danbooru_tag_expander-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fbf07a4cb8b13add7d19aea44c47cbe951d2b023cc5bd2ef4c005ccd16cdf19e
MD5 add780f8078b5b2b97e8ecb832407387
BLAKE2b-256 69e526877f58f711de4f3f7e96cb39c1b29b1a2c78be3f37ef5669b5dae9cb0b

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