GithubHelp home page GithubHelp logo

sebagomez / shelltwit Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 4.0 12.92 MB

๐Ÿ’ป+๐Ÿค Command line twitter client

Home Page: https://hub.docker.com/r/sebagomez/shelltwit/

C# 96.96% Shell 1.00% Dockerfile 2.04%
c-sharp twitter-api dotnet hacktoberfest

shelltwit's Introduction

.NET Build Docker Build
Join the chat at https://gitter.im/sebagomez/shelltwit

shelltwit

shelltwit updates your twitter status while at the command line. It's a good example of twitter API calls with xAuth. As of Jun-05-2017 it uses PIN-based authorization

shelltwit running on Windows

shelltwit running on Linux (WSL2)

Little more (?) info about it at the original blog post

Build

The repo contains a single .NET solution, which reference newly created twitterlib NuGet package. After downloading the repo just build the sln with Visual Studio 2019 (or higher). You can also use VSCode and use the ./build.sh script for building the project.

This build has been tested on Ubuntu WSL, Windows and MacOs, so it works on my machine.

After building the code just run it as you would usually run a dotnet console app:

dotnet Sebagomez.Shelltwit.dll

For obvious security reasons I don't have the app Key and Secrets embeded in the code. If you want to run the app with your own crdentials you can setup two Environment variables named TWITTER_API_KEY and TWITTER_API_SECRET. With these, shelltwit will run as your registered twitter app.

Docker

In order to build your own container you must run the following command

docker run -e "TWITTER_API_KEY=<Your Twitter Key>" -e "TWITTER_API_SECRET=<Your Twitter Secret>" -it --name twit sebagomez/shelltwit 

Copy and paste the provided URL in your favorite browser, authorize the app to access twitter on your behalf and copy and paste the provided PIN in the command line waiting for it.

Now you have a container with the needed credentials to access the Twitter API.

We'll now commit those changes into a new image:

docker commit twit mytwit

And that's it, you can now call commands inside the newly created image as follows:

docker run --rm mytwit --help
๐Ÿค Sebagomez.Shelltwit version 9.3.1.0                                                                                                                                                         
Copyright 2022 @SebaGomez                                                                                                                                                                      
                                                                                                                                                                                               
Usage: twit [options] | <status> [<mediaPath>]

Options:
        -c|--clear              clears user stored credentials
        -t|--timeline [count]   show user's timeline, optionally set how many twits to display (up to 200)
        -q|--query <query>      query twits containing words
        -m|--mentions           show user's mentions
        -u|--user <handle>      show another user's timeline
        -k|--track <track>      live status with a specific track
        -s|--streamed <handle>  streamed user timeline
        -l|--likes              user's likes (fka favorites)
        -d|--dm <handle> <message>      direct message to user
        -x|--dm-list            last 20 DM messages
        -h|--help               show this help

status:
        status to update at twitter.com

mediaPath:
        full path, between brackets, to the media files (up to four) to upload.

Edit: You can also use the following command to copy your existing credentials into your docker container

docker cp ./last.usr twit:/twit
docker cp ./sebagomez.data twit:/twit

shelltwit's People

Contributors

sebagomez avatar gitter-badger avatar azure-pipelines[bot] avatar

Stargazers

Rofiq Setiawan avatar  avatar Jonas Gauffin avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

shelltwit's Issues

Improve command line options

I would like to have better parsing support and improved options like docker or dotnet where you can write --workdir or -w and both have the same semantic.
The rule should be, one - for single letter, two for the word (command)

Could not update status with Emoji

Tried to tweet an emoji and got the following error:

Response was not OK: {"errors":[{"code":32,"message":"Could not authenticate you."}]}

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.