Giter Club home page Giter Club logo

ap4j's Introduction

AP4J

An Anime-Planet API using Jsoup DOM Parsing
Requires the Jsoup library and Java JRE 8

Small example which searches for an anime based on name and prints out some information

  public static void main(String[] args) {
      APApi api = new APApi();
        
      AnimeSearchFilter filter = new AnimeSearchFilter();
      filter.setName("kimi no na wa");
      List<AnimePreview> list = api.searchAnime(filter);
        
      if (!list.isEmpty()) {
            
          AnimePreview preview = list.get(0);
            
          System.out.println("Title: " + preview.getTitle());
          System.out.println("Studio: " + preview.getStudio());
          System.out.println("Episodes: " + preview.getEpisodes());
          System.out.println("Rating: " + preview.getRating());
          System.out.println("Tags: " + preview.getTags());
            
          AnimePage page = api.fetchAnimePage(preview);
            
          System.out.println("Rank: #" + page.getRank());
          System.out.println("Watched Count: " + page.getUserStats().getWatched());
          System.out.println("Dropped Count: " + page.getUserStats().getDropped());
            
            
          List<AnimePreview> recommendedList = page.getRecommendedList();
            
          System.out.println("");
          System.out.println("Similar Anime:");
          for (AnimePreview recPreview : recommendedList) {
              System.out.println(recPreview.getTitle());
          }
      }
  }

The output should be:

Title: your name.
Studio: CoMix Wave Inc.
Episodes: 1
Rating: 4.721
Tags: [Drama, Romance, Body Swapping, Original Work, School Life, Supernatural]
Rank: #1
Watched Count: 16644
Dropped Count: 29

Similar Anime:
5 Centimeters per Second
ERASED
Your lie in April
The Girl Who Leapt Through Time

There are currently two search filters:
AnimeSearchFilter which searches through all anime
UserAnimeSearchFilter which searches through an user's anime list

Some other search examples:

    AnimeSearchFilter filter = new AnimeSearchFilter();
    filter.setName("kimi");
    filter.setStudio("comix");
    filter.addType(AnimeSearchFilter.Type.MOVIE);
    List<AnimePreview> list = api.searchAnime(filter);

    UserAnimeSearchFilter userFilter = new UserAnimeSearchFilter("sothis");
    userFilter.setStatusType(UserAnimeSearchFilter.StatusType.WATCHED);
    userFilter.addTag("scifi");
    userFilter.setSortType(UserAnimeSearchFilter.SortType.RATING);
    userFilter.setSortOrder(UserAnimeSearchFilter.SortOrder.DESCENDING);
    List<AnimePreview> userWatchedList = api.searchAnime(userFilter);

ap4j's People

Contributors

bloc97 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ap4j's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.