本文整理汇总了Python中feed.Feed.add_crosslink方法的典型用法代码示例。如果您正苦于以下问题:Python Feed.add_crosslink方法的具体用法?Python Feed.add_crosslink怎么用?Python Feed.add_crosslink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类feed.Feed
的用法示例。
在下文中一共展示了Feed.add_crosslink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: max
# 需要导入模块: from feed import Feed [as 别名]
# 或者: from feed.Feed import add_crosslink [as 别名]
wordlists = {}
for child in feed:
title = feed.get_title(child)
summary = feed.get_description(child)
content = feed.get_content(child)
link = feed.get_link(child)
gid = feed.get_id(child)
# Check for duplicates
maxcmplvl = 0
wordlist = comparetext.analyse(lang, title, summary, content)
for index, dic in wordlists.items():
t = comparetext.comp(wordlist, dic)
maxcmplvl = max(maxcmplvl, t)
if t > settings.cmp_threshold:
feed.add_crosslink(index, link, title)
logging.warn(_("removing news entry: %(duplicate)s\n\tas duplicate of: %(news)s") %
{'duplicate': title, 'news': feed.get_title(index)})
continue
if maxcmplvl > settings.cmp_threshold:
feed.remove_item(child)
continue
else:
wordlists[gid] = wordlist
# Check against blackwords
lvl = wordfilter.check(title, settings.title_scale)
if content != "":
lvl += wordfilter.check(content, 1)
elif summary != "":
lvl += wordfilter.check(summary, 1)