InstagramApiSharp icon indicating copy to clipboard operation
InstagramApiSharp copied to clipboard

A word about FB and Insta (logging_client_events)

Open ramtinak opened this issue 2 years ago • 1 comments

About Instagram: Private version of InstagramApiSharp updated to latest api version [currently using v239.0.0.14.111]. Story link, and like/unlike stories features, have already been added and more bugfixes and improvements have already been done.

A full implementation of graph.instagram.com/logging_client_events will come to InstagramApiSharp. I didn't decide to share it publicly or only add it to private version of InstagramApiSharp (the sure thing it will be part of the private version).

About Facebook: I've created a new library for Facebook. It's the private API of Facebook application for the Android Platform. FacebookApiSharp's features:

  • [x] Login via email(phone number) and password
  • [x] Make a text post
  • [x] Upload a photo to your wall
  • [x] Get friends list
  • [x] Search people
  • [x] Login sessions
  • [x] Send Comment
  • [x] Get direct inbox friends
  • [x] Get direct inbox recently
  • [x] Send DM text

FacebookApiSharp's library is based on InstagramApiSharp's library, so if you know how InstagramApiSharp's library works, you can use FacebookApiSharp as well. A quick example:

var userSession = new UserSessionData
{
    UserName = "Facebook Email or Phone number",
    Password = "Facebook Password"
};

IFacebookApi FacebookApi = FacebookApiBuilder.CreateBuilder()
    .SetUser(userSession)
    //.UseLogger(new FileDebugLogger(LogLevel.All))
    .UseLogger(new DebugLogger(LogLevel.All))
    .SetRequestDelay(RequestDelay.FromSeconds(0, 1))
    // Session handler, set a file path to save/load your state/session data
    .SetSessionHandler(new FileSessionHandler { FilePath = StateFile })

    //// Setting up proxy if you needed
    //.UseHttpClientHandler(httpClientHandler)
    .Build();

FacebookApi.SimCountry = FacebookApi.NetworkCountry = "us"; // lower case< us => united states
FacebookApi.ClientCountryCode = "US"; // most be upper case<US =>  united states
FacebookApi.AppLocale = FacebookApi.DeviceLocale = "en_US"; // if you want en_US , no need to set these


// load old session
FacebookApi.SessionHandler?.Load();

if (!FacebookApi.IsUserAuthenticated) // if we weren't logged in
{
    await FacebookApi.SendLoginFlowsAsync();

    var loginResult = await FacebookApi.LoginAsync();
    if (loginResult.Succeeded)// logged in
    {
        //// library will saves session automatically, so no need to do this:
        //FacebookApi.SessionHandler?.Save();
        Connected();
        // after we logged in, we need to sends some requests
        await FacebookApi.SendAfterLoginFlowsAsync();
    }
    else
    {
        switch (loginResult.Value)
        {
            case FacebookLoginResult.WrongUserOrPassword:
                MessageBox.Show("Wrong Credentials (user or password is wrong)");

                break;

            case FacebookLoginResult.RenewPwdEncKeyPkg:
                MessageBox.Show("Press login button again");
                break;
        }
    }
}
else
{
    Connected();
}

If you are interested in any of the above features, check #243. If you have any questions regarding the subscription and other stuff, contact me via [email protected] or [email protected]

ramtinak avatar Jun 18 '22 14:06 ramtinak

I am interested in FacebookApiSharp library, can I contact you via telegram?

xuan2261 avatar Jul 26 '22 09:07 xuan2261