コード例 #1
0
 def on_status(self, status):
    message = TwitterMessage(date_time_generated=status.created_at,
                               text_message = status.text,
                               message_id = str(status.id),
                               user_name = status.author.screen_name)
    message.save()
コード例 #2
0
 
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

import tweepy
from logger import crawl_logs
from models import TwitterMessage
from couchdbkit import Server

#Instantiate elements server and database
server = Server()
db = server.get_or_create_db('crawls')

#Associate all models with Couchdb 
TwitterMessage.set_db(db)

class CrawlingService:
   def crawl(self):
      raise NotImplementedError("crawl method must be implemented in subclass")


class GoogleNewsCrawlingService(CrawlingService):
   pass


class BingNewsCrawlingService(CrawlingService):
   pass


class BloggerCrawlingService(CrawlingService):