Skip to content
George Kye edited this page Feb 22, 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.tv_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.tv_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.tv_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 similar TV shows for a specific tv id.

   TVMDB.tv_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.tv_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.tv_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.tv_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.tv_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.tv_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.tv_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