-
Notifications
You must be signed in to change notification settings - Fork 239
InstagramApiSharp supports Instagram TV (ig tv).
You can find all ig tv functions in IInstaApi.TVProcessor class.
This API is TV Guide, here with this function you can get your own channel and other channels:
var tvGuide = await InstaApi.TVProcessor.GetTVGuideAsync();
There are five different types exists for TV Channel.
-
InstaTVChannelType.ChronoFollowing
for your following channels. -
InstaTVChannelType.Popular
for popular channels -
InstaTVChannelType.ContinueWatching
for continue watching channels -
InstaTVChannelType.User
for self user channel -
InstaTVChannelType.ForYou
suggested channels for you
var channelByType = await InstaApi.TVProcessor
.GetChannelByTypeAsync(InstaTVChannelType.Popular, PaginationParameters.MaxPagesToLoad(1));
var user = await InstaApi.UserProcessor.GetUserAsync("instagram");
var channelByUserId = await InstaApi.TVProcessor
.GetChannelByIdAsync(user.Value.Pk, PaginationParameters.MaxPagesToLoad(1));
var suggestedSearches = await InstaApi.TVProcessor.GetSuggestedSearchesAsync();
You can search username or channel name with this function
var search = await InstaApi.TVProcessor.SearchAsync("channel name or username");
You can upload an video to your TV Channel easily but there are some notes you have to know first.
- Aspect ratio of your video must be something between 0.5 - 1.0 . unless you will receive an aspect ratio error.
- Aspect ratio of your video thumbnail must be something between 0.5 - 1.0 . unless you will receive an aspect ratio error.
- 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
- 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");
Iranian Developers (c) 2021 | Bahar 1400