Git Product home page Git Product logo

facebookapisharp's Introduction

FacebookApiSharp

A Tiny Private Facebook API for .NET based on Android version.

IRANIAN DEVELOPERS


Features:

  • Login with facebook using email/phone and password
  • Search users
  • Get friends
  • Get direct inbox friends
  • Get direct top friends
  • Send direct text
  • Make new post
  • Upload photo

Note

This library is NOT intend to be getting new updates/features by me(Ramtin).

I just shared the project to help people for their start.

This library won't publish to Nuget.org by me.

Build this library by yourself. If you have problem with building it, try removing some platforms in the FacebookApiSharp.csproj in line 4.

Sample

You won't get any sample for this, this library is just like InstagramApiSharp's library, So, if you know how to use InstagramApiSharp's library, you can use FacebookApiSharp's library as well.

var userSession = new UserSessionData
{
    User = "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();
}

Terms and conditions

  • Use this Library at your own risk.
  • Don't ask me anything about this library, just use it and figure it out the problem you might ran into.

Warning

Note 1: This library doesn't send all the request(s) that is sending by real Facebook app.

Note 2: This library doesn't send any logs to Facebook server.

License

MIT.

Legal

This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by Facebook or any of its affiliates or subsidiaries. This is an independent and unofficial API wrapper.

Iranian developers - (c) 2022 | Paeez 1401.

facebookapisharp's People

Contributors

ramtinak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.