github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

balinterdi / twuckoo

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 4
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (5)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • get-lines-loads-from-file-the-first-time
    • master ✓
  • Tags (0)
Sending Request…
Click here to lend your support to: twuckoo and make a donation at www.pledgie.com ! Edit Pledgie Setup

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Need to tweet periodically in an automated fashion? Then Twuckoo is for you! — Read more

  cancel

http://github.com/balinterdi/twuckoo/tree/master

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

slight modification in README 
balinterdi (author)
Tue Jan 26 00:36:27 -0800 2010
commit  5c82f333543f6e554391ef747f6bd9aa6b284054
tree    50c3109e11e3cc1abf645bae33026a7f01224ff0
parent  7295e977ad2b57a85a5f4196c2fc1f3c0fbd7727
twuckoo /
name age
history
message
file .gitignore Wed Jan 13 05:14:51 -0800 2010 - using jeweler instead of echoe - a name (iden... [balinterdi]
file CHANGELOG Fri Aug 07 08:17:09 -0700 2009 release v0.2.2 [balinterdi]
file MIT-LICENSE Mon Jan 18 02:50:28 -0800 2010 MIT license [balinterdi]
file Manifest Tue Jun 16 00:55:18 -0700 2009 updating gemspec so that it does not go looking... [balinterdi]
file README.markdown Tue Jan 26 00:36:27 -0800 2010 slight modification in README [balinterdi]
file Rakefile Mon Jan 18 12:03:05 -0800 2010 sending notification emails and actually sendin... [balinterdi]
file VERSION Mon Jan 18 12:02:30 -0800 2010 Version bump to 0.3.5 [balinterdi]
directory bin/ Mon Jan 18 02:11:01 -0800 2010 inadvertently deleted gem's binary, too, in f1a... [balinterdi]
directory lib/ Mon Jan 18 12:03:05 -0800 2010 sending notification emails and actually sendin... [balinterdi]
directory spec/ Wed Jan 13 05:38:15 -0800 2010 if no name is given, use the directory name as ... [balinterdi]
directory tasks/ Tue Jan 12 02:25:17 -0800 2010 using bundler and clearing up requires [balinterdi]
file twuckoo.gemspec Mon Jan 18 12:04:24 -0800 2010 regenerate gemspec for 0.3.5 [balinterdi]
README.markdown

Twuckoo

Need to tweet periodically and in an automated fashion? Then Twuckoo is for you. Still not convinced? :) Read on.

Abstract

Twuckoo fulfills the task of periodically fetching a message and tweeting it (Twuckoo = Twitter + Cuckoo). Since we all prefer code to words, I'll show you its main loop:

def run
  ...
  while next_tweet do
    tweet(next_tweet)
    wait if wait_between_tweets?
    next_tweet = self.next
    notify if next_tweet.nil?
  end
end

It is very simple in its design but opens vast possibilities due to its modular approach.

A simple API

Twuckoo takes a modular approach. It defines a very simple API and expects modules to implement these API methods. The methods are:

* load_tweets

Loads the possible tweets that twuckoo will use when selecting the next one. This could be reading all lines from a file, for example.

* next

Fetches the next message to be tweeted. Usually the bulk of the "business logic" is implemented here. This could be scraping a web page and extracting a specific snippet of html.

* store(tweet)

Hands the last tweeted message to be stored. In the case of the one_line_from_file module, this stores the tweet in a file so that no message is used multiple times.

Twuckoo needs to be passed the name of the module to be used. At the moment there are two provided modules:

  • file

Loads all the lines from a file (lines.txt) and tweets one line randomly each time.

  • wikipedia_tfa

Scraps Wikipedia's main page and extracts the name and link of Today's Featured Article. This is not as general a module as file. I am thinking about how to best make a "web" module out of this.

Installation

gem install twuckoo --source http://gemcutter.org

Twuckoo depends on twibot and a couple of other gems which will also get installed with the above command.

In order for twibot to be able to connect to your twitter account, a config/bot.yml file need to be present at where you launch twuckoo from. It has to contain the following lines at least:

login: my_login
password: my_password

For more options, see twibot's README

Configuration

Twuckoo's configuration options have to be written into config/twuckoo.yml. The current options are:

  • time_to_sleep

By default, it is "1d", so the script will "relax" for 24 hours after tweeting. The value should be given in a human-comprehensible form. You can use any combination of weeks, days, hours, minutes and seconds, so 1w3d13h27m19s will work, too, although you probably do not want to be this precise :)

  • user
  • password
  • email

When twuckoo is out of messages to tweet, it quits. Most of the times you'll want to get notified of this, though, so you can take action (e.g refill it and relaunch). If the above options are set, twuckoo sends an email to email, using the user and password credentials for gmail authentication. (Yes, currently only gmail is supported, I am planning to change that in a next version.)

Running

You have to indicate the module you wish to use:

$ twuckoo file

Will make use of the file module. There has to be a lines.txt file in the directory where you run twuckoo from that contains the possible tweets, one tweet per line. The tweeted lines will be stored in a file called used_lines.txt so you should have write permission to the directory.

or

$ twuckoo wikipedia_tfa

(see above)

You can also provide a name for the twuckoo instance which appears in the notifications (if you do not provide a name explicitly, the name of the directory in which your twuckoo instance runs will get used):

$ twuckoo -n pragthinklearn file

Examples out there

In the course of the development of this gem I "ate my own dogfood" so you'll find at least one twitter account for each of the modules:

  • Pragmatic Thinking and Learning

An concise advice from the excellent Pragmatic Thinking and Learning book

  • Daily Oblique

Serves you an Oblique Strategy per day.

  • Wikipedia Today's Featured Article

An interesting article from the English Wikipedia delivered right to your twitter feed.

If you set up something with twuckoo, I would like to know about it, so that I might include it here.

Credits & License

This software is released under the MIT license (see attached). A link back to this page would be appreciated if you release something based on it.

Any feedback (especially bug reports!) is highly appreciated, please report them here or contact me at balint@codigoergosum.com

Original idea and development: Balint Erdi

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server