anitube_crawler_api 0.2.6+2

anitube_crawler_api #

Build Status

Anitube website crawler API. This dart package is a simple library to fetch animes and episodes data from the brazilian Anitube website.
This package gets the website html pages, parse them and returns the data using a well formatted data model classes.

This package is part of the AnimeStore mobile app project.

Features #

  • Fetch the most recent episode posts
  • Fetch the most recent anime posts
  • Fetch the most visualized animes
  • Fetch the daily releases
  • Fetch animes genres available
  • Fetch anime details with episode list
  • Fetch episodes details with video stream link

Usage #

To use this plugin, add anitube_crawler_api as a dependency in your pubspec.yaml file. For example:

  dependencies:
    anitube_crawler_api: 0.2.6+2

The API #

The main API is very simple. You just need to use the AniTubeApi class methods to get all the data that you want.

///you need include this file only.
import 'package:anitube_crawler_api/anitube_crawler_api.dart';
/// create a instance.
final AniTubeApi api = AniTubeApi();

Getting the Anitube homepage data #

HomePageInfo homePage = await api.getHomePageData(timeout: localTimeout));
// HomePageInfo brings all information about the anitube website home page 
// using a well formated model.
// Checking the data that homePage brings to you.
print(homePage.dayReleases ); // Data type is List<AnimeItem>
print(homePage.latestEpisodes); // Data type is List<EpisodeItem>
print(homePage.mostRecentAnimes); // Data type is List<AnimeItem>
print(homePage.mostShowedAnimes); // Data type is List<AnimeItem>

Getting details about an "anime" like title, author, episodes reference list, genre and more... #

  // getting the first anime released.
 AnimeItem anime = homePage.dayReleases[0];
 
 // use id property of AnimeItem instance.
 AnimeDetails details = await api.getAnimeDetails( anime.id,timeout: localTimeout);
 
 // check the anime details property
 print(details);

Getting episode details like the stream Url #

  // details is an AnimeDetails instance.
  var episodeList = details.episodes; // getting List<EpisodeItem>
  // getting the first episode from the list
  var desiredEpisode = episodeList[ 0 ];
 
 // use id property of EpisodeItem instance.
 EpisodeDetails episode = await api.getEpisodeDetails( desiredEpisode.id,timeout: localTimeout);
 
 // printing episode title
 print(episode.title)
 // printing episode stream URL
 print(episode.streamUrl);
 // checking EpisodeDetails class properties
 print(episode);

Getting all genres available. #

  List<String> genres = await api.getGenresAvailable();
  // print the list with all avaialble genre names.
  print(genres);

Getting all the animes in anitube website. #

  // AnimeListPageInfo instance holds data about the current
  // anime list page included the anime item list and the current page
  // number and the max page number both are useful to do pagination.
  AnimeListPageInfo pageInfo = await api.getAnimeListPageData(
    // 1 is the default page number
    pageNumber = 1,
  );
  // prints the current page number
  print(pageInfo.pageNumber);
  
  // prints the last page number
  print(pageInfo.maxPageNumber);
  
  // prints the list with AnimeItem objects which comes with the current page.
  print(pageInfo.animes);

The search engine used is from the anitube website. Sometimes it returns undesired results but most cases it works well.

    // the search can be anything. A letter, a anime name, studio name etc.
    String query = "Shigeki no kyojin";
  
    AnimeListPageInfo searchPageInfo =  await api.search(
        query,
        pageNumber = 1, // the default page number is 1.
    );
  
    // prints the current search page number
    print(searchPageInfo.pageNumber);
  
    // prints the last page number
    print(searchPageInfo.maxPageNumber);
  
    // prints the list with AnimeItem objects which comes with the current search page.
    print(searchPageInfo.animes);
    
    //NOTE: sometimes a query can have more than 1 page, in this cases
    // if you want more results to the same query string value YOU MUST call search method again using the same query but a different pageNumber
    
    // getting the page 2 for the query string.
    AnimeListPageInfo searchPageInfo2 =  await api.search(
        query,
        pageNumber = 2,);

[0.2.6+2] 19/02/2020

  • Updating dependencies
  • Adding README documentation.

[0.2.6+1] 17/02/2020

  • Solving fail in stream link parsing. The links were starting with "le:" and "ge:" strings.
  • VideoPageParser class deprecated.
  • Modifying the tests to be aware of this bad behavior.

[0.2.6] 10/02/2020

  • get video stream url adpted to the new changes in anitube.site webpage.
  • adding Travis CI.

[0.2.5] 27/12/2019

  • EpisodeDetails model now brings animeId property.

[0.1.5] 15/12/2019

  • Bug fix. Handling properly ItemParse execptions.

[0.1.4] 07/12/2019

  • Updating anime list, search by letter and genre list page paths.

[0.1.3+1] - 11/11/2019

  • Enable Refer header property support. EpisodeDetails instances now comes with a refer property. That is used to execute the episode.

[0.1.2+1] - 24/12/2019

  • Fixing Anime details page parsing handling no resume available.

[0.1.2] - 24/12/2019

  • Fixing Anime details page parsing.

[0.1.1] - 16/10/2019

  • Fixing episode stream URL issue.

[0.1.0] - 24/08/2019

  • Initial release.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  anitube_crawler_api: ^0.2.6+2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:anitube_crawler_api/anitube_crawler_api.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Feb 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health suggestions

Format lib/anitube_crawler_api.dart.

Run flutter format to format lib/anitube_crawler_api.dart.

Format lib/example/example_file.dart.

Run flutter format to format lib/example/example_file.dart.

Format lib/src/network/AnimeDetailsPageFetcher.dart.

Run flutter format to format lib/src/network/AnimeDetailsPageFetcher.dart.

Fix additional 12 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/network/AnimeListPageFetcher.dart (Run flutter format to format lib/src/network/AnimeListPageFetcher.dart.)
  • lib/src/network/EpisodeDetailsPageFetcher.dart (Run flutter format to format lib/src/network/EpisodeDetailsPageFetcher.dart.)
  • lib/src/network/EpisodeVideoPageFetcher.dart (Run flutter format to format lib/src/network/EpisodeVideoPageFetcher.dart.)
  • lib/src/network/GenrePageFetcher.dart (Run flutter format to format lib/src/network/GenrePageFetcher.dart.)
  • lib/src/network/HomePageFetcher.dart (Run flutter format to format lib/src/network/HomePageFetcher.dart.)
  • lib/src/network/UserAgents.dart (Run flutter format to format lib/src/network/UserAgents.dart.)
  • lib/src/parser/AnimeDetailsPageParser.dart (Run flutter format to format lib/src/parser/AnimeDetailsPageParser.dart.)
  • lib/src/parser/AnimeListPageParser.dart (Run flutter format to format lib/src/parser/AnimeListPageParser.dart.)
  • lib/src/parser/EpisodeDetailsPageParser.dart (Run flutter format to format lib/src/parser/EpisodeDetailsPageParser.dart.)
  • lib/src/parser/HomePageParser.dart (Run flutter format to format lib/src/parser/HomePageParser.dart.)
  • lib/src/parser/ItemParser.dart (Run flutter format to format lib/src/parser/ItemParser.dart.)
  • lib/src/parser/VideoPageParser.dart (Run flutter format to format lib/src/parser/VideoPageParser.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and anitube_crawler_api.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio ^3.0.8 3.0.9
flutter 0.0.0
html ^0.14.0+2 0.14.0+3
Transitive dependencies
charcode 1.1.3
collection 1.14.11 1.14.12
csslib 0.16.1
http_parser 3.1.3
meta 1.1.8
path 1.6.4
sky_engine 0.0.99
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test