GithubHelp home page GithubHelp logo

tidusjar / threads.api Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 2.0 2.1 MB

Unofficial .NET client for Meta's Threads.

License: GNU General Public License v3.0

C# 100.00%
instagram meta threads threads-api threads-client threads-sdk

threads.api's Introduction

Contributors Forks Stargazers Issues Nuget


Threads.Api

An unoffical .Net wrapper for the meta Threads API


Report Bug · Request Feature

Usage


Post

IThreadsApi api = new ThreadsApi(new HttpClient());
var authToken = await api.LoginAsync("tidusjar", "password");
await api.PostAsync("tidusjar", "Hello!", authToken);

Follow & UnFollow

IThreadsApi api = new ThreadsApi(new HttpClient());

var authToken = await api.LoginAsync("tidusjar", "password");

var userNameToFollow = "zuck";
var userToFollow = await api.GetUserIdFromUserNameAsync(userNameToFollow);
await api.FollowAsync(userToFollow.UserId, userToFollow.Token, authToken);
await api.UnFollowAsync(userToFollow.UserId, userToFollow.Token, authToken);

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

Jamie - @tidusjar - [email protected]

Project Link: https://github.com/tidusjar/Threads.Api

threads.api's People

Contributors

tidusjar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

threads.api's Issues

utf-8 and token error

hello there.

I am getting an error like this on this line.

var text = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

'"utf-8"' is not a supported encoding name. See the documentation for the Encoding.RegisterProvider method for information on defining a custom encoding.
Parameter name: name

and when i try to get token from api this warning comes

var token = await api.GetTokenAsync("username", "password");

{"message":"Payload returned is null. A server error field_exception occured. Check server logs for details.","status":"fail"}

where do you think i am going wrong can you help me

LoginAsync

Passing in the correct username and password and unable to login and fetch token.

{"layout":{"bloks_payload":{"data":[],"props":[{"id":"-6917714003244327204","name":"ttrc_instance_id"},{"id":"2231046902902521263","name":"override_login_success_action"},{"id":"-3430068907069239942","name":"override_login_2fa_action"}],"error_attribution":{"logging_id":"{\"callsite\":\"{\\\"product\\\":\\\"bloks_caa_login\\\",\\\"feature\\\":\\\"com.bloks.www.bloks.caa.login.async.send_login_request\\\",\\\"integration\\\":\\\"bloks_screen\\\",\\\"oncall\\\":\\\"caa_login\\\"}\",\"push_phase\":\"C3\",\"version\":1,\"request_id\":\"AT4QMw6p8uUd3g9pvZKaZDd\"}","source_map_id":"fskos7:4"},"tree":{"㐟":{"#":" (bk.action.core.TakeLast, (bk.action.core.TakeLast, (bk.action.qpl.MarkerAnnotate, (bk.action.i32.Const, 2293785), (bk.action.i32.Const, 0), (bk.action.map.Make, (bk.action.array.Make, \"login_type\", \"login_source\"), (bk.action.array.Make, \"Password\", \"Login\"))), (bk.action.qpl.MarkerAnnotate, (bk.action.i32.Const, 2293785), (bk.action.i32.Const, 0), (bk.action.map.Make, (bk.action.array.Make, \"end_point\"), (bk.action.array.Make, \"generic_error_dialog\"))), (bk.action.qpl.MarkerEndV2, (bk.action.i32.Const, 2293785), (bk.action.i32.Const, 0), (bk.action.i32.Const, 87), (bk.action.tree.Make, (bk.action.i32.Const, 13704)))), (bk.action.core.TakeLast, (bk.action.core.FuncConst, (bk.action.i32.Const, 1)), (ig.action.cdsdialog.OpenDialog, (bk.action.tree.Make, (bk.action.i32.Const, 13799), (bk.action.i32.Const, 40), \"Unmapped IG Error\", (bk.action.i32.Const, 35), \"This IG Error was not mapped to an Error Code. To fix it, update the error tool under 'CAA' to map it to an Error Code.\", (bk.action.i32.Const, 36), (bk.action.tree.Make, (bk.action.i32.Const, 13800), (bk.action.i32.Const, 36), \"OK\", (bk.action.i32.Const, 35), (bk.action.core.FuncConst, (bk.action.logging.LogEvent, \"caa_login_client_events_ig\", \"\", (bk.action.map.Make, (bk.action.array.Make, \"core\", \"login_params\"), (bk.action.array.Make, (bk.action.map.Make, (bk.action.array.Make, \"event\", \"event_category\", \"event_flow\", \"event_request_id\", \"event_step\", \"is_dark_mode\", \"exception_code\", \"exception_message\", \"exception_type\", \"extra_client_data\", \"logged_out_identifier\", \"logged_in_identifier\", \"waterfall_id\", \"reduction_push_phase\", \"reduction_region\"), (bk.action.array.Make, \"login_error_dialog_ok_clicked\", \"login_home_page_interaction\", \"login_manual\", \"0320a1b7-f541-4ee6-8f38-2000f6df4710\", \"home_page\", (ig.action.IsDarkModeEnabled), (bk.action.i32.Const, 0), \"\", \"\", (bk.action.map.Make, (bk.action.array.Make, \"login_source\", \"is_from_switcher\", \"fblite_client_id\", \"is_from_logged_out\"), (bk.action.array.Make, \"Login\", \"0\", \"\", \"0\")), \"\", \"\", \"47d8fffc-23b9-409b-8a6a-a9a47f544531\", \"C3\", \"loudoun\")), (bk.action.map.Make, (bk.action.array.Make), (bk.action.array.Make))))))), (bk.action.i32.Const, 42), (bk.action.i32.Const, 0)), (bk.action.tree.Make, (bk.action.i32.Const, 13808))), (bk.action.core.TakeLast, (bk.action.qpl.MarkerAnnotate, (bk.action.i32.Const, 2293785), (bk.action.i32.Const, 0), (bk.action.map.Make, (bk.action.array.Make, \"login_type\", \"login_source\"), (bk.action.array.Make, \"Password\", \"Login\"))), (bk.action.qpl.MarkerAnnotate, (bk.action.i32.Const, 2293785), (bk.action.i32.Const, 0), (bk.action.map.Make, (bk.action.array.Make, \"end_point\"), (bk.action.array.Make, \"generic_error_dialog\"))), (bk.action.qpl.MarkerEndV2, (bk.action.i32.Const, 2293785), (bk.action.i32.Const, 0), (bk.action.i32.Const, 87), (bk.action.tree.Make, (bk.action.i32.Const, 13704)))), (bk.action.map.Make, (bk.action.array.Make, \"should_dismiss_loading\", \"has_identification_error\"), (bk.action.array.Make, (bk.action.bool.Const, true), (bk.action.bool.Const, false)))))"}}}},"status":"ok"}

The main error:

This IG Error was not mapped to an Error Code. To fix it, update the error tool under 'CAA' to map it to an Error Code.

Can't login threads api, Threads have changed the authentication mechanism

https://i.instagram.com/api/v1/bloks/apps/com.bloks.www.bloks.caa.login.async.send_login_request/

result :
{"layout":{"bloks_payload":{"data":[],"props":[{"id":"-6917714003241327602","name":"ttrc_instance_id"},{"id":"2231046902902122168","name":"override_login_success_action"}],"error_attribution":{"logging_id":"{\"callsite\":\"{\\\"product\\\":\\\"bloks_caa_login\\\",\\\"feature\\\":\\\"com.bloks.www.bloks.caa.login.async.send_login_request\\\",\\\"integration\\\":\\\"bloks_screen\\\",\\\"oncall\\\":\\\"caa_login\\\"}\",\"push_phase\":\"C3\",\"version\":1,\"request_id\":\"Aw8S2rvIkpAnkIKLo5XF6Za\"}"},"tree":{"㐟":{"#":" (bk.action.core.TakeLast, (ig.action.cdsdialog.OpenDialog, (bk.action.tree.Make, (bk.action.i32.Const, 13799), (bk.action.i32.Const, 40), \"Unable to log in\", (bk.action.i32.Const, 35), \"An unexpected error occurred. Please try logging in again.\", (bk.action.i32.Const, 36), (bk.action.tree.Make, (bk.action.i32.Const, 13800), (bk.action.i32.Const, 36), \"OK\", (bk.action.i32.Const, 35), (bk.action.core.FuncConst, (bk.action.logging.LogEvent, \"caa_login_client_events_ig\", \"\", (bk.action.map.Make, (bk.action.array.Make, \"core\", \"login_params\"), (bk.action.array.Make, (bk.action.map.Make, (bk.action.array.Make, \"event\", \"event_category\", \"event_flow\", \"event_request_id\", \"event_step\", \"is_dark_mode\", \"exception_code\", \"exception_message\", \"exception_type\", \"extra_client_data\", \"logged_out_identifier\", \"logged_in_identifier\", \"waterfall_id\"), (bk.action.array.Make, \"login_error_dialog_ok_clicked\", \"login_home_page_interaction\", \"login_manual\", \"6ad13371-dd93-41b2-9636-c5357946dfa3\", \"home_page\", (ig.action.IsDarkModeEnabled), (bk.action.i32.Const, 0), \"\", \"\", (bk.action.map.Make, (bk.action.array.Make), (bk.action.array.Make)), \"\", \"\", \"7e8ccada-d140-44b5-b583-7ef54a58a11c\")), (bk.action.map.Make, (bk.action.array.Make), (bk.action.array.Make))))))), (bk.action.i32.Const, 42), (bk.action.i32.Const, 0)), (bk.action.tree.Make, (bk.action.i32.Const, 13808))), (bk.action.map.Make, (bk.action.array.Make, \"should_dismiss_loading\"), (bk.action.array.Make, (bk.action.bool.Const, true))))"}}}},"status":"ok"}

Previously it was very smooth to log in and make a post with API, but now I can't log in using the API even though the data/param is correct and there is no problem in the Instagram account :(

GetUserIdFromUserNameAsync error

After your last update, features such as logging in, following, unfollowing are working fine, but GetUserIdFromUserNameAsync function gives the following error.

'"utf-8"' is not a supported encoding name. See the documentation for the Encoding.RegisterProvider method for information on defining a custom encoding.
Parameter name: name

I manually enter the user ids and the functions work fine.

do you have this problem? Is there a function I should check? and can you add the following as a feature

  • like
  • undelete likes
  • get follower list

[Request] Threads after...

Are you planning to add a function to get threads after a specific thread ID and/or date?
Something like that:

Function GetThreadsAsync(username As String, after As String, userId As Integer, token As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of UserThreads)

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.