TweetFixer will keep an eye on your Twitter account and when it sees a URL, it will delete the tweet and replace it with a custom short url from your bit.ly account or a YOURLS shortener (along with the existing tweet text). It will also drill down any short links it finds until it reaches the root URL, courtesy of longurl.org. All of this takes place within 1 second, so most people won't ever notice a thing. It works on both tweets and retweets
I got tired of not having better analytics on the links I was sending out on Twitter and, in some cases, generating money for other people because they used a shortener which had ads. Bit.ly's free account and YOURLS both provide pretty good analytics on links.
- Make a new file named
config.jsonin the root directory. - Put this in there:
settings = {
"useragent": "tweetfixer/0.0.2 by Robbie Trencheny <http://github.com/robbiet480/tweetfixer>",
"shortener": "yourls",
"twitter": {
"consumer_key": "",
"consumer_secret": "",
"access_token_key": "",
"access_token_secret": "",
"user_id": "46713",
"source": "<a href=\"Domain.com\" rel=\"nofollow\">App Name</a>"
},
"bitly": {
"username": "",
"api_key": ""
},
"yourls": {
"username":"",
"password":"",
"domain":""
}
}- Change the values to suit your needs. For shortener, the valid values are yourls or bitly
- Save
config.jsonin the root directory - Run
node app.js
You need to setup a new application on your Twitter account. To do this:
-
Go to dev.twitter.com
-
Sign in and create a new app.
-
Name it whatever you want (preferably something without apostrophes etc).
-
Make sure you change the permissions model to read AND write.
-
Then go back to the main app page and at the bottom click generate access details to get the access_token_key and access_token_secret.
-
All the keys and secrets go into the config.json file
- Ankur Oberoi for the function/callback help
node app.js
- 0.0.2: Separate settings file, YOURLS support.
- 0.0.1: Initial release. bit.ly support only
Fork it, change it, pull request it