📱 API Documentation

Integrate Movies Hub data into your Android app in minutes. Follow the step-by-step guide below.

🔗 API Endpoints

All movie data is served as raw JSON from this GitHub repository. No authentication required. Data is refreshed daily via GitHub Actions.

Category Endpoint URL
All Movies https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/movies.json
Hindi https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/hindi/hindi.json
Marathi https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/marathi/marathi.json
English https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/english/english.json
Tamil https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/tamil/tamil.json
Telugu https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/telugu/telugu.json
Kannada https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/kannada/kannada.json
Cartoons https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/cartoons/cartoons.json
Comedy https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/comedy/comedy.json
Taarak Mehta https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/taarak_mehta/taarak_mehta.json
Yam Hain Hum https://raw.githubusercontent.com/samyak2403/daily-movies-api/main/movies/yam_hain_hum/yam_hain_hum.json

📦 JSON Structure

Each endpoint returns a JSON object with the following structure:

JSON Response
{
  "last_updated": "2026-03-09T14:38:53.918075Z",
  "total_movies": 102,
  "movies": [
    {
      "id": "qyNeS_hFyxk",
      "title": "Movie Title Here",
      "url": "https://www.youtube.com/watch?v=qyNeS_hFyxk",
      "duration": 8633.0,
      "view_count": 2867026,
      "uploader": "Channel Name",
      "category": "Hindi",
      "thumbnail": "https://i.ytimg.com/vi/qyNeS_hFyxk/hqdefault.jpg"
    }
  ]
}

🛠️ Android Integration (Kotlin)

Follow these steps to integrate the movie data into your Android app using Retrofit.

1 Add Dependencies

Add these to your app-level build.gradle:

build.gradle (app)
dependencies {
    // Retrofit for networking
    implementation "com.squareup.retrofit2:retrofit:2.9.0"
    implementation "com.squareup.retrofit2:converter-gson:2.9.0"

    // Coroutines for async operations
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"

    // Glide for image loading
    implementation "com.github.bumptech.glide:glide:4.16.0"
}

2 Create Data Models

Define Kotlin data classes matching the JSON structure:

Movie.kt
data class MovieResponse(
    val last_updated: String,
    val total_movies: Int,
    val movies: List<Movie>
)

data class Movie(
    val id: String,
    val title: String,
    val url: String,
    val duration: Double?,
    val view_count: Long?,
    val uploader: String?,
    val category: String,
    val thumbnail: String?
)

3 Create API Interface

Define the Retrofit API service:

MovieApiService.kt
import retrofit2.http.GET

interface MovieApiService {

    @GET("samyak2403/daily-movies-api/main/movies/movies.json")
    suspend fun getAllMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/hindi/hindi.json")
    suspend fun getHindiMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/marathi/marathi.json")
    suspend fun getMarathiMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/english/english.json")
    suspend fun getEnglishMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/tamil/tamil.json")
    suspend fun getTamilMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/telugu/telugu.json")
    suspend fun getTeluguMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/kannada/kannada.json")
    suspend fun getKannadaMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/cartoons/cartoons.json")
    suspend fun getCartoonMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/comedy/comedy.json")
    suspend fun getComedyMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/taarak_mehta/taarak_mehta.json")
    suspend fun getTaarakMehtaMovies(): MovieResponse

    @GET("samyak2403/daily-movies-api/main/movies/yam_hain_hum/yam_hain_hum.json")
    suspend fun getYamHainHumMovies(): MovieResponse
}

4 Set Up Retrofit Instance

Create a singleton Retrofit client:

RetrofitClient.kt
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

object RetrofitClient {

    private const val BASE_URL = "https://raw.githubusercontent.com/"

    val apiService: MovieApiService by lazy {
        Retrofit.Builder()
            .baseUrl(BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build()
            .create(MovieApiService::class.java)
    }
}

5 Use in ViewModel

Fetch movies using Kotlin Coroutines in your ViewModel:

MovieViewModel.kt
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

class MovieViewModel : ViewModel() {

    private val _movies = MutableStateFlow<List<Movie>>(emptyList())
    val movies: StateFlow<List<Movie>> = _movies

    private val _isLoading = MutableStateFlow(false)
    val isLoading: StateFlow<Boolean> = _isLoading

    fun fetchAllMovies() {
        viewModelScope.launch {
            _isLoading.value = true
            try {
                val response = RetrofitClient.apiService.getAllMovies()
                _movies.value = response.movies
            } catch (e: Exception) {
                e.printStackTrace()
            } finally {
                _isLoading.value = false
            }
        }
    }

    fun fetchByCategory(category: String) {
        viewModelScope.launch {
            _isLoading.value = true
            try {
                val response = when (category) {
                    "hindi" -> RetrofitClient.apiService.getHindiMovies()
                    "marathi" -> RetrofitClient.apiService.getMarathiMovies()
                    "english" -> RetrofitClient.apiService.getEnglishMovies()
                    "tamil" -> RetrofitClient.apiService.getTamilMovies()
                    "telugu" -> RetrofitClient.apiService.getTeluguMovies()
                    "kannada" -> RetrofitClient.apiService.getKannadaMovies()
                    "cartoons" -> RetrofitClient.apiService.getCartoonMovies()
                    else -> RetrofitClient.apiService.getAllMovies()
                }
                _movies.value = response.movies
            } catch (e: Exception) {
                e.printStackTrace()
            } finally {
                _isLoading.value = false
            }
        }
    }
}

6 Display in RecyclerView

Observe the StateFlow and populate a RecyclerView:

MainActivity.kt (snippet)
// In your Activity or Fragment
private val viewModel: MovieViewModel by viewModels()

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    // Fetch all movies on start
    viewModel.fetchAllMovies()

    // Observe movies
    lifecycleScope.launch {
        viewModel.movies.collect { movieList ->
            // Update your RecyclerView adapter
            adapter.submitList(movieList)
        }
    }

    // Observe loading state
    lifecycleScope.launch {
        viewModel.isLoading.collect { loading ->
            progressBar.visibility = if (loading) View.VISIBLE else View.GONE
        }
    }
}

💡 Tips

🎬 Open Movie in YouTube

Kotlin
fun openMovie(context: Context, movieUrl: String) {
    val intent = Intent(Intent.ACTION_VIEW, Uri.parse(movieUrl))
    context.startActivity(intent)
}