Skip to content
George Kye edited this page Mar 7, 2016 · 12 revisions

Get the primary information about a TV series by id.

     TVMDB.tv(apikey, tvShowID: 870, language: "en"){
            apiReturn in
            if( apiReturn.error == nil){
                let tv = apiReturn.MBDBReturn as! TVDetailedMDB
                print(tv.name)
                print(tv.last_air_date)
                print(tv.seasons)
            }
        }

Get the alternative titles for a specific show ID.

        TVMDB.alternativeTitles(apikey, tvShowID: 60735){
            apiReturn in
            let altTitles = apiReturn.MBDBReturn as! Alternative_TitlesMDB
            print(altTitles.titles[0])
            print(altTitles.id)
        }

Get the cast & crew information about a TV series. Just like the website, this information is from the last season of the series.

        TVMDB.credits(apikey, tvShowID: 871){
            apiReturn in
            let credits = apiReturn.MBDBReturn as! CastCrewMDB
            for i in credits.cast {
                print(i.name)
            }
            for i1 in credits.crew {
                print(i1.job)
            }
        }

Get the images (posters and backdrops) for a TV series.

    TVMDB.images(apikey, tvShowID: 60735, language: "en"){
            apiReturn in
            let tvImages = apiReturn.MBDBReturn as! ImagesMDB
            print(tvImages.backdrops[0].height)
            print(tvImages.posters[0].file_path)
        }

Get the plot keywords for a specific TV show id.

       TVMDB.keywords(apikey, tvShowID: 1396){
            apiReturn in
            let keywords = apiReturn.MBDBReturn as! [KeywordsMDB]
            for keyword in keywords{
                print(keyword.id)
                print(keyword.name)
            }
        }

Get the similar TV shows for a specific tv id.

   TVMDB.similar(apikey, tvShowID: 1398, page: 1, language: "en"){
            apiReturn in
            if( apiReturn.error == nil){
                let tv = apiReturn.MBDBReturn as! [TVMDB]
                if(apiReturn.pageResults?.total_results > 0){
                    print(tv[0].name)
                    print(tv[0].genreIds)
                }
            }
        }

Get the videos that have been added to a TV series (trailers, opening credits, etc...)

    TVMDB.videos(apikey, tvShowID: 60735, language: "en"){
            apiReturn in
            let videos = apiReturn.MBDBReturn as! [VideosMDB]
            for i in videos {
                print(i.site)
            }
        }

Get the latest TV show id.

   TVMDB.latest(apikey){
            apiReturn in
            if( apiReturn.error == nil){
                let tv = apiReturn.MBDBReturn as! TVDetailedMDB
                print(tv.name)
                print(tv.last_air_date)
                print(tv.seasons)
                print(tv.episode_run_time)
                print(tv.createdBy)
            }
        }

Get the list of TV shows that are currently on the air.
This query looks for any TV show that has an episode with an air date in the next 7 days.

 TVMDB.ontheair(apikey, page: 1, language: "en"){
            apiReturn in
            let tv = apiReturn.MBDBReturn as! [TVMDB]
            print(tv[0].name)
            print(tv[0].popularity)
            print(tv[0].first_air_date)
            print(tv[0].overview)
            print(apiReturn.pageResults?.total_pages)
        }

Get the list of TV shows that air today. Without a specified timezone, this query defaults to EST (Eastern Time UTC-05:00).

           TVMDB.airingtoday(apikey, page: 2, language: "en", timezone: "Asia/Baku"){
            apiReturn in
            let tv = apiReturn.MBDBReturn as! [TVMDB]
            print(tv[0].name)
            print(tv[0].popularity)
            print(tv[0].first_air_date)
            print(tv[0].overview)
            print(apiReturn.pageResults?.total_pages)
        }

Get the list of top rated TV shows. By default, this list will only include TV shows that have 2 or more votes. This list refreshes every day.

                TVMDB.toprated(apikey, page: 1, language: "en"){
                    apiReturn in
                    let tv = apiReturn.MBDBReturn as! [TVMDB]
                    print(tv[0].name)
                    print(tv[0].popularity)
                    print(tv[0].first_air_date)
                    print(tv[0].overview)
                }

Get the list of popular TV shows. This list refreshes every day.

        TVMDB.popular(apikey, page: 1, language: "en"){
            apiReturn in
            let tv = apiReturn.MBDBReturn as! [TVMDB]
            print(tv[0].name)
            print(tv[0].popularity)
            print(tv[0].first_air_date)
            print(tv[0].overview)
        }
Clone this wiki locally