https://github.com/aspiring-aster/twim
A X(Formally known as Twitter) API wrapper library for Nim.
https://github.com/aspiring-aster/twim
nim nim-lang twitter twitter-api x x-api
Last synced: about 1 month ago
JSON representation
A X(Formally known as Twitter) API wrapper library for Nim.
- Host: GitHub
- URL: https://github.com/aspiring-aster/twim
- Owner: aspiring-aster
- License: mit
- Created: 2024-06-16T16:51:46.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-24T04:46:19.000Z (6 months ago)
- Last Synced: 2025-03-23T18:46:54.971Z (about 2 months ago)
- Topics: nim, nim-lang, twitter, twitter-api, x, x-api
- Language: Nim
- Homepage: https://aspiring-aster.github.io/twim/
- Size: 107 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# twim
A X(Formally known as Twitter) API wrapper library for Nim. Inspired by [Tweepy](https://www.tweepy.org/) and [twitter.nim](https://github.com/snus-kin/twitter.nim).
Be aware I only have free-tier API access to the X API so I will only develop for those [endpoints](https://developer.x.com/en/docs/x-api/migrate/x-api-endpoint-map).
This uses OAuth 1.0a.
## Endpoints supported:
- POST v2/tweets
- POST media/upload## Install
```Bash
nimble install twim
```## Example
```Nim
import twimwhen isMainModule:
# This is API Key
const CONSUMER_KEY = "CONSUMERKEY"# This is the API secret key
const CONSUMER_SECRET = "CONSUMERSECRET"# This is the Authentication Access Token
const ACCESS_TOKEN = "ACCESSTOKEN"# This is the Authentication Access Secret
const TOKEN_SECRET = "TOKENSECRET"const xCli = newXAPI(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, TOKEN_SECRET)
let res = xCli.PostTextTweet("Hello from twim!")
echo res
```Look at the [OMORI upscale bot](https://github.com/aspiring-aster/omori-upscale-bot-v2/tree/main) as an example for how to use this API to deploy a bot on Twitter.
## Dependencies
- [nimcrypto](https://github.com/cheatfate/nimcrypto) - For SHA1-HMAC encoding to encode signature
## RoadMap:
- Look at the [GitHub Project](https://github.com/users/aspiring-aster/projects/1?query=is%3Aopen+sort%3Aupdated-desc)
- All progress will be on [unstable](https://github.com/aspiring-aster/twim/tree/unstable) until the issue is completed
- If there's any feature you'd like to see, please submit an issue 😄