Exemple #1
0
 def GET(self, tag_word):
     chat_tag = TapeChatTag()
     try:
         user_id = session.user_id
     except:
         user_id = 0
     return render.tags(chat_tag.tag_text(tag_word, user_id), urllib.unquote(tag_word), user_id)
Exemple #2
0
 def GET(self, tag_counter):
     try:
         user_id = session.user_id
     except:
         user_id = 0
     chat_tag = TapeChatTag()
     chat_tag.generate_stream(tag_counter)
     return simplejson.dumps(chat_tag.all_entries)
Exemple #3
0
    def GET(self):
        try:
            user_id = session.user_id
        except:
            user_id = 0

        try:
            chat_tag = TapeChatTag()
            if web.input(page="page")["page"]:
                chat_tag.page_value = web.input(page="page")["page"]
            chat_tag.generate(user_id=user_id)
            return render.index(chat_tag.all_entries, chat_tag.next_page, chat_tag.prev_page, user_id)
        except:
            return render.index("", -1, -1, user_id)
import feedparser
import re
import urllib
from redis import Redis
from BeautifulSoup import BeautifulSoup
from auto_tagify import AutoTagify
from tapechat_tag import TapeChatTag
from time import time

VALID_TAGS = ['p']
tag = AutoTagify()
tag.link = '/tags'
tapechat_tag = TapeChatTag()
r = Redis()
text_unique = []

feeds = r.sort("global:feeds",desc=True)
circle_sym = re.compile('(•)|(\xe2\x80\xa2)')
p_tags = re.compile('(<p>)|(</p>)')

for feed_id in feeds:
  feed = r.get("fid:" + str(feed_id) + ":url")
  rss = feedparser.parse(feed)
  for entry in rss.entries:
    if not r.exists("guid:" + str(entry.guid) + ":fid"):
      clean_text = BeautifulSoup(entry.summary)
      for t in clean_text.findAll(True):
        if t.name not in VALID_TAGS: t.hidden = True
      tag.text = p_tags.sub(' ',clean_text.renderContents())
      sanitized_text = tag.generate()
      text_id = r.incr("global:nextTextId")