Simple Command Line Utility for Generating Twitter Floods
This simple command line utility is for generating Twitter Floods from a paragraph of text. It accepts the paragraph as file and divides it into 280-char chunks then posts to Twitter by replying to the previous post. So creates a flood like below.
Generating a Twitter flood is simple.
Clone the repo and run npm install
in the root folder
Create a file named like twitter-keys.env
and fill it with below info then source it with source twitter-keys.env
using terminal.
export TWITTER_CONSUMER_KEY=xxxx
export TWITTER_CONSUMER_SECRET=xxxx
export TWITTER_ACCESS_TOKEN_KEY=xxxx
export TWITTER_ACCESS_TOKEN_SECRET=xxxx
Produce the text file including the Tweet. Text in a paragraph will be divided into 280 char-chunks and Tweeted however if you want a sentece to start a Tweet just use a new line before.
Example, an input file like below will produce two Tweets although will fit to one due to new line
This is the first line
This is the second line
In order to use media files, start a line in the input file with M:<image-file-path>
and write the text that will be included with the image. If you would like to have no text with the image, do not add any text after the image input.
This is the first line of a flood with media
M:<resources/test-images/test-image-1.jpg>Text that goes with the image
This is the third tweet indeed
M:<resources/test-images/test-image-2.png>
Run below command to generate and post the Tweets.
$ node main.js <file_name>
Use -d
option to see how Tweets like before posting it to twitter.
$ node main.js -d <file_name>
Use -r
option to reply to an existing Tweet, useful when replying to somebody else or continuation of an old status.
$ node main.js -r <status_id> -d <file_name>
Use -m
option to limit the number of characters per tweet if you think 280-chars are too many.
$ node main.js -m 240 -d <file_name>
Create an env file (let's say twitter.env
) that contains the following envs:
TWITTER_CONSUMER_KEY=xxxx
TWITTER_CONSUMER_SECRET=xxxx
TWITTER_ACCESS_TOKEN_KEY=xxxx
TWITTER_ACCESS_TOKEN_SECRET=xxxx
Build the dockerfile
of the project (Optional, you can use gsengun/twitter-flood
image from DockerHub):
$ docker build -f Dockerfile -t tfg .
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
tfg latest 7500a250bafa 1 hours ago 68.6MB
Let our text file mytext
that needs to be posted on twitter be like:
Ov yeah!
After building the image or just using existing docker image gsengun/twitter-flood
, make a container Tweeting the text on twitter on behalf of you:
$ docker run --rm --env-file twitter.env -v $(pwd)/mytext:/mytext tfg:latest /mytext
Updating status: Ov yeah!
$ docker run --rm --env-file twitter.env -v $(pwd)/mytext:/mytext gsengun/twitter-flood:latest /mytext
Updating status: Ov yeah!