InstagramApiSharp icon indicating copy to clipboard operation
InstagramApiSharp copied to clipboard

get post of specific user by username

Open keyhanbati opened this issue 4 years ago • 1 comments

hi every body i have a question about get post of specific user by username i want to know how this can be done ? tnx a lot

keyhanbati avatar Feb 16 '21 07:02 keyhanbati

Hey, I think this might work:

string username = "elonmusk"
var currentUserMedia = await api.UserProcessor
   .GetUserMediaAsync(username, PaginationParameters.MaxPagesToLoad(5));

It returns type IResult<InstaMediaList> So iiuc this will iterate through the uploaded posts.

foreach (var media in currentUserMedia.Value){
//Do stuff here
}

Code from Examples/Samples/Basics

I'd recommend looking at the examples.

TimothyMakkison avatar Feb 19 '21 18:02 TimothyMakkison