Skip to content

Tipical Api maded with Jsoup scrap potentially with kotlin coroutines, with a similar builder pattern

Notifications You must be signed in to change notification settings

darkryh/MonosChinosApi

Repository files navigation

Api lib with similar patron as a Builder Pattern + Builded with kotlin + Kotlin Coroutines 🎈

Installation

with Gradle

repositories {   
	maven { url 'https://jitpack.io' }  
}  
  
dependencies {  
	implementation("com.github.darkryh:MonosChinosApi:$version")
}  

Example to get HomePage

ViewModel() {

	fun getHome(context : Context) = viewModelScope.launch(IO) {

		val home : Home? = MonosChinos
                .builder(context)
                .homePage()
                .get()
				
		val lastChapter : List<HomeChapter> = home?.lastChapters
		val recentSeries : List<HomeAnime> = home?.recentSeries
	}
}

Example to Search Anime

ViewModel() {

	fun getAnimes(context : Context) = viewModelScope.launch(IO) {

		val animeList : List<Anime> = MonosChinos
                .builder(context)
                .searchPage("death note")
                .get()
	}
}

Example to get Anime Details

ViewModel() {

	fun getAnimes(context : Context) = viewModelScope.launch(IO) {

		val animeList : List<Anime> = MonosChinos
                .builder(context)
                .searchPage("death note")
                .get()
			
		val anime = animeList.first()
			
		//the seo is the id set the query
			
		val animeDetail = MonosChinos
                .builder(context)
                .animeDetailPage(anime.seo)
                .get()
	}
}

Requests

  • Home : the function homePage().get() return a list
  • Player : the function playerPager(seo : String).get() return a Player?, the server options
  • Search : the function searchPage(name : String).get() return a list
  • AnimeDetail : the function animeDetailPage(seo : String) return AnimeDetail?
  • Chapters : the function chaptersPage(seo : String) return a list

Objects

data class Home(
    val lastChapters : List<HomeChapter>,
    val recentSeries : List<HomeAnime>
)
data class HomeAnime(
    val seo : String,
    val title : String,
    val type : String,
    val image : String,
    val url : String
)
data class HomeChapter(
    val seo : String,
    val title : String,
    val number : Int,
    val type : String,
    val image : String,
    val url : String
)
data class Anime(
    val seo : String,
    val title : String,
    val type : String,
    val year : Int,
    val image : String,
    val url : String
)
data class AnimeDetail(
    val title : String,
    val alternativeTitle : String?,
    val status : String,
    val coverImage : String,
    val profileImage : String,
    val release : String,
    val synopsis : String,
    val genres : List<String>
)
data class Episode(
    val seo : String,
    val number : Int,
    val image : String,
    val url : String
)
data class Player(
    val options : List<String>,
    val downloads : List<String>
)

Want to Contribute

No problem sr, just contact me in my X account @Darkryh or just make a request.

About

Tipical Api maded with Jsoup scrap potentially with kotlin coroutines, with a similar builder pattern

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages