From eec6b1b6fd17d2f6ff36dacd828c2cc6de4d753e Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 14 Sep 2012 04:17:25 +0200 Subject: twinter:whitelist messages --- god/twinter/init_stripped.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'god/twinter/init_stripped.py') diff --git a/god/twinter/init_stripped.py b/god/twinter/init_stripped.py index 092d239a..4d359171 100644 --- a/god/twinter/init_stripped.py +++ b/god/twinter/init_stripped.py @@ -2,6 +2,7 @@ import os.path import sys import tweepy +import re from socket import * CONSUMER_KEY = '' CONSUMER_SECRET = '' @@ -13,7 +14,8 @@ auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) api = tweepy.API(auth) mention = api.mentions()[0] -mention_stripped = mention.text.replace("@shacktwinter","").lstrip().rstrip().replace(" "," ")[:32] +mention_stripped = mention.text.replace("@shacktwinter","").lstrip().rstrip() +mention_stripped = re.sub(r'[^\w _|@\[\]{}()<>:;!#$%^&+=-]+','',mention_stripped)[:32] f = open(os.path.dirname(os.path.abspath(sys.argv[0]))+"/msg_file","r+") last = f.read() #sys.exit(23) -- cgit v1.2.3