A library for easy access to the Kinopoisk data.
- Add the JitPack repository to your build file
build.gradle
allprojects {
repositories {
maven { url 'https://www.jitpack.io' }
}
}
or pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://www.jitpack.io</url>
</ repository>
</ repositories>
- Add the dependency
build.gradle
dependencies {
implementation 'com.github.TrueDevProfile:kinopoisk-api:1.0.0'
}
or pom.xml
<dependency>
<groupId>com.github.TrueDevProfile</groupId>
<artifactId>kinopoisk-api</artifactId>
<version>1.0.0</ version>
</dependency>
You should sign up and get an access token here https://kinopoiskapiunofficial.tech/. Then you can use token to use api:
- Kotlin
val kinopoiskApiService = KinopoiskApiService("api token")
val result = kinopoiskApiService.getFilm(301)
when (result) {
is Result.Success -> result.getOrNull() /*actually null is possible only for Failure*/
is Result.Failure -> /*handle somehow*/
}
or
val kinopoiskApiService = KinopoiskApiService("api token")
// if success it will return value otherwise it will be null
val result = kinopoiskApiService.getFilm(301).getOrNull()
- Java
KinopoiskApiService kinopoiskApiService = new KinopoiskApiService("api token",15000);
// if success it will return value otherwise it will be null
Film film = kinopoiskApiService.getFilm(301,new ArrayList<>()).getOrNull();