Skip to content
Ramtin Jokar edited this page Dec 16, 2018 · 7 revisions

InstagramApiSharp supports Instagram TV (ig tv).

You can find all ig tv functions in IInstaApi.TVProcessor class.

How can I get popular and suggested TV channels?

This API is TV Guide, here with this function you can get your own channel and other channels:

var tvGuide = await InstaApi.TVProcessor.GetTVGuideAsync();

How can I get a single TV channel by type?

There are five different types exists for TV Channel.

  1. InstaTVChannelType.ChronoFollowing for your following channels.
  2. InstaTVChannelType.Popular for popular channels
  3. InstaTVChannelType.ContinueWatching for continue watching channels
  4. InstaTVChannelType.User for self user channel
  5. InstaTVChannelType.ForYou suggested channels for you
var channelByType = await InstaApi.TVProcessor
     .GetChannelByTypeAsync(InstaTVChannelType.Popular, PaginationParameters.MaxPagesToLoad(1));

How can I get a single TV Channel by user PK (user id)[specific user]?

var user = await InstaApi.UserProcessor.GetUserAsync("instagram");

var channelByUserId = await InstaApi.TVProcessor
     .GetChannelByIdAsync(user.Value.Pk, PaginationParameters.MaxPagesToLoad(1));

How can I get suggested searches?

var suggestedSearches = await InstaApi.TVProcessor.GetSuggestedSearchesAsync();

How can I search in instagram tv?

You can search username or channel name with this function

var search = await InstaApi.TVProcessor.SearchAsync("channel name or username");

How can I upload a video to my Instagram TV channel?

You can upload an video to your TV Channel easily but there are some notes you have to know first.

  1. Aspect ratio of your video must be something between 0.5 - 1.0 . unless you will receive an aspect ratio error.
  2. Aspect ratio of your video thumbnail must be something between 0.5 - 1.0 . unless you will receive an aspect ratio error.
  3. Instagram app will change resolution to one this, so it's recommended to resize your video:
width X height
480x852
640x1072
720x1208
750x1258
1080x1680
1080x1812

Use FFmpeg to resize your video, it's an cross platform and open source multimedia library.

Note 1: I created an tiny wrapper of FFmpeg for .NET called FFmepgFa, you can use it to resize or create thumbnail from videos.

Note 2: to calculate aspect ratio, you should divide width and height: width / height = aspect ratio

  1. Video length must be between 15 seconds and 10 minutes.
// ONLY MP4 or MOV FILE
var video = new InstaVideo
{
    Uri = @"Video path"
    // or
    // VideoBytes = Video bytes
};
// ONLY JPEG FILE
var videoThumbnail = new InstaImage
{
    Uri = @"Thumbanil path"
    // or 
    // ImageBytes = Image bytes
};
var videoUpload = new InstaVideoUpload
{
    Video = video,
    VideoThumbnail = videoThumbnail
};
            
var uploadResult = await InstaApi
     .TVProcessor.UploadVideoAsync(videoUpload, "video title - important", "caption - optional");