예제 #1
0
파일: main.py 프로젝트: cadl/MoeGengxin
    def get(self):
        html = "<html><head><title>MoeWeibo</title></head><body>"

        c = self.request.get("add")
        if(len(c)>0):
            if(moeforbidden.addForbidden(c)):
                html += "Add success<br/>"
            else:
                html += "Add fail<br/>"
        c = self.request.get("remove")
        if(len(c)>0):
            if(moeforbidden.removeForbidden(c)):
                html += "Remove success<br/>"
            else:
                html += "Remove fail<br/>"
        
        html += "<ul>"
        l = moeforbidden.getForbidden()
        for d in l:
            html += "<li>"+d+"</li>"
        html += "</ul><br/>"
        html += """
        Add:<form method="get">
        <input name="add" />
        <input type="submit" />
        </form><br/>"""
        html += """
        Remove:<form method="get">
        <input name="remove" />
        <input type="submit" />
        </form><br/>"""
        html += "PS.All characters are lowered</br>"
        html += "</body></html>"
        self.response.write(html)
예제 #2
0
    def get(self):
        html = "<html><head><title>MoeWeibo</title></head><body>"

        c = self.request.get("add")
        if (len(c) > 0):
            if (moeforbidden.addForbidden(c)):
                html += "Add success<br/>"
            else:
                html += "Add fail<br/>"
        c = self.request.get("remove")
        if (len(c) > 0):
            if (moeforbidden.removeForbidden(c)):
                html += "Remove success<br/>"
            else:
                html += "Remove fail<br/>"

        html += "<ul>"
        l = moeforbidden.getForbidden()
        for d in l:
            html += "<li>" + d + "</li>"
        html += "</ul><br/>"
        html += """
        Add:<form method="get">
        <input name="add" />
        <input type="submit" />
        </form><br/>"""
        html += """
        Remove:<form method="get">
        <input name="remove" />
        <input type="submit" />
        </form><br/>"""
        html += "PS.All characters are lowered</br>"
        html += "</body></html>"
        self.response.write(html)
예제 #3
0
def parseFeed(feed_url):
	feeds = feedparser.parse(feed_url)
	clean_feeds = []
	forbidden = moeforbidden.getForbidden()
	forbidden_utf8 = []
	for f in forbidden:
		forbidden_utf8.append(force_unicode(f))
	for item in feeds["items"]:
		if(checkSummary(item["summary"], forbidden_utf8) and checkSummary(item["title"], forbidden_utf8)):
			clean_feeds.append({"title":item["title"],"link":cleanLink(item["link"]),
				"date":datetime.datetime.fromtimestamp(time.mktime(item.updated_parsed))})
	return clean_feeds