I'm making an Android application and connecting YouTube API there and I need to get sort videos that I get. For example: only long, normal videos and only short videos. I'm new to YouTube API, and I don't know how to do it.
Can anyone help?
There is small part of my code:
RetroInstance file code:
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
object RetroInstance {
fun retroInstance(): YoutubeService {
return Retrofit.Builder()
.baseUrl("https://www.googleapis.com/youtube/v3/")
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(YoutubeService::class.java)
}
}
And YoutubeService code:
import com.example.alaproapp.model.YoutubeModel
import retrofit2.*
import retrofit2.http.GET
import retrofit2.http.Query
interface YoutubeService {
@GET("search")
fun getAllData(
@Query("key") key: String = "key",
@Query("channelId") channelId: String = "UCHVY_-jY-FayjszyX1nlGtQ",
@Query("order") order: String = "date",
@Query("maxResults") maxResult: String = "1800",
@Query("part") part: String = "snippet,id"
): Call<YoutubeModel>
}
I tried to use documentation, but how I mentioned earlier I'm new to this, and I don't understand how to do it.