gelbooru 4.0.0 copy "gelbooru: ^4.0.0" to clipboard
gelbooru: ^4.0.0 copied to clipboard

A universal package for connectiong ot various gelbooru based imageboards.

A simple client for using the API of Gelbooru's based imageboards.

Features #

  • Implements all the endpoint of the Gelbooru API
  • Doesn't use any scrapping method
  • Use Dart's native http package for making requests allowing for using more advanced implementation on the fly.

Getting started #

Run the following command:

# the http package is required because we use ClientException from it
$ dart pub add gelbooru http

Usage #

import 'dart:io';

import 'package:gelbooru/gelbooru.dart';
import 'package:http/http.dart';

/// Get last 10 posts from Gelbooru
void main() async {
  final client = GelbooruClient.gelbooru(
      apiKey: 'your_api_key',
      userId: 'your_user_id',
      userAgent: 'your_user_agent');

  List<Post> posts;

  try {
    posts = await client.posts.index(limit: 10);

    /// Exception that happens when the client can't connect to the server
  } on ClientException catch (cex) {
    print(cex.message);
    exit(0);

    /// Exception that happens when the server returns an error
  } on GelbooruException catch (gex) {
    print(gex.message);
    exit(0);
  }

  for (Post post in posts) {
    print('${post.fileUrl}');
  }
}

Additional information #

  • The package isn't conceived to actually detect if the imageboard is Gelbooru based.

No AI project / AI free Project #

This project is written WITHOUT any AI assistance. If you fork this project and use AI please remove this section.

0
likes
140
pub points
35%
popularity

Publisher

verified publisherprojetretro.io

A universal package for connectiong ot various gelbooru based imageboards.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

http, meta, xml

More

Packages that depend on gelbooru