annas_archive_api 0.2.3 copy "annas_archive_api: ^0.2.3" to clipboard
annas_archive_api: ^0.2.3 copied to clipboard

Anna's archive API is an easy to use SDK for interacting with the popular Anna's Archive Service. It provides a simple interface for fetching and parsing data from the service.

example/main.dart

import 'package:annas_archive_api/annas_archive_api.dart';

Future<void> main() async {
  // Finds books from Anna's Archive.
  await AnnaApi()
      .find(const SearchRequest(
    query: 'harry potter',
    author: 'rowling',
    categories: [Category.fiction],
    sources: [AnnaSource.zLibrary, AnnaSource.internetArchive],
    formats: [Format.epub, Format.pdf],
    skip: 1,
    limit: 10,
    language: Language.french,
    sort: SortOption.smallest,
  ))
      .then((response) async {
    for (final Book book in response.books) {
      print(book.title);
    }

    // Get download links for a book.
    await AnnaApi()
        .getDownloadLinks(response.books.first.md5)
        .then((downloadLinks) {
      for (final String link in downloadLinks) {
        print(link);
      }
    });
  });

  // Finds journals from Anna's Archive.
  await AnnaApi()
      .findJournal(const SearchJournalRequest(
    query: '',
    skip: 1,
    limit: 10,
    language: Language.french,
    sources: [AnnaSource.libgenLi],
    sort: SortOption.newest,
  ))
      .then((response) {
    for (final Book book in response.books) {
      print(book.title);
    }
  });

  // Fetches a collection of books from GoodReads.
  const collectionUrl =
      'https://www.goodreads.com/review/list/145381477-alvyn-fasuyi?ref=nav_mybooks';
  await AnnaApi()
      .fetchCollection(const CollectionRequest(
          type: Collection.goodReads, url: collectionUrl))
      .then((response) {
    for (final Book book in response) {
      print(book.title);
    }
  });
}
1
likes
0
points
308
downloads

Publisher

verified publishertribestick.com

Weekly Downloads

Anna's archive API is an easy to use SDK for interacting with the popular Anna's Archive Service. It provides a simple interface for fetching and parsing data from the service.

Homepage

License

unknown (license)

Dependencies

beautiful_soup_dart, compute, freezed_annotation, http, json_annotation

More

Packages that depend on annas_archive_api