aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlas Oliva <blasoliva@gmail.com>2015-02-10 12:21:02 -0300
committerBlas Oliva <blasoliva@gmail.com>2015-02-10 12:21:02 -0300
commit834fcd27b190ac7b8cd578cd300c47272143af6f (patch)
tree011860948d0d72f13d26d8321c576b713df1daf9
parentef5fb88f626c9b115c3c0ce936a77cc4cd0eeca1 (diff)
downloadreebot-834fcd27b190ac7b8cd578cd300c47272143af6f.tar.gz
reebot-834fcd27b190ac7b8cd578cd300c47272143af6f.zip
strip html tags
-rwxr-xr-xreebot.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/reebot.py b/reebot.py
index a8dd59c..490f4fe 100755
--- a/reebot.py
+++ b/reebot.py
@@ -8,6 +8,7 @@ import sys
8import threading 8import threading
9import time 9import time
10import os 10import os
11import re
11 12
12from config import * 13from config import *
13from messages import messages 14from messages import messages
@@ -116,6 +117,9 @@ class rBot:
116 """ Read feeds and sends the news to the channel """ 117 """ Read feeds and sends the news to the channel """
117 118
118 msgqueue = [] 119 msgqueue = []
120
121 # Strip html tags regex
122 r = re.compile('<.*?>')
119 123
120 # Get feeds list from mongo 124 # Get feeds list from mongo
121 feed_list = self.db.feed_list.find() 125 feed_list = self.db.feed_list.find()
@@ -129,7 +133,7 @@ class rBot:
129 if self.db.log.find_one( { "url" : entry.link } ) is None: 133 if self.db.log.find_one( { "url" : entry.link } ) is None:
130 msgqueue.append( feed['name'] 134 msgqueue.append( feed['name']
131 + " | " + feeds.feed.title + " > " 135 + " | " + feeds.feed.title + " > "
132 + " : " . join(map(lambda tag : entry[tag], feed['tags'])) ) 136 + " : " . join(map(lambda tag : re.sub(r, '', entry[tag]), feed['tags'])) )
133 # Insert link into log database 137 # Insert link into log database
134 self.db.log.insert( { "url" : entry.link } ) 138 self.db.log.insert( { "url" : entry.link } )
135 139