#!/usr/bin/python import sys import time import random import simplejson from twibots import tb, sources, filters, channels from twibots import tools tb.Channel.fake = True twibot = tb.Twibot() tools.enable_debug() access_tokens = tools.file_auth() twitter = tools.twitter_auth(access_tokens) rss = sources.RssFeed( feed_url="http://www.google.com/reader/public/atom/user/08886841141873836783/state/com.google/broadcast", count=10 ) twitter.filters.append(filters.NoRetweets()) twitter.filters.append(filters.NoDuplicates()) twitter.filters.append(filters.Bitly(username="******", api_key="R_9f3bde0c5e2d36a3e747490bb37a6d5d")) twitter.filters.append(filters.InlineHashtags()) twitter.filters.append(filters.TagsToHashtags()) twitter.filters.append(filters.YouTubeEmbed()) twitter.filters.append(filters.Trim140(max_length=100)) twibot.sources.append(rss) twibot.channels.append(twitter)
import time import random import simplejson from twibots import tb, sources, filters, channels from twibots import tools # Enable the --debug key. tools.enable_debug() # Enable the --auth "authfile.auth" key and read values. access_tokens = tools.file_auth() # Try the access values, create a twitter object. If access credentials # are invalid, this will take you through the OAuth registration # process and ask to save tokens to file at the end. twitter = tools.twitter_auth(access_tokens, CONSUMER_KEY='QDEynLeQO02GDrfVAGgBcw', CONSUMER_SECRET='ZrLAECDSbNHNMNcApjXeSoEmcjllltEME0g3fV2chuk') # Let's use Google Reader # Let's look for the --cache "file.cache" key in the command line args. # If they exist we can load the cache data from the file, otherwise # use it later to save the cache. if '--cache' in sys.argv: cache_filename = sys.argv[sys.argv.index('--cache')+1] logging.debug("Using cache file: %s" % cache_filename) try: cache = file(cache_filename) cache_values = simplejson.load(cache) cache.close() except: cache_values = [] logging.debug("Cache load failed (empty?)")