mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +01:00
RSS: add option to strip url redirects from headlines
Conflicts: plugins/RSS/config.py
This commit is contained in:
parent
20bef2dcd0
commit
e4ddda4aeb
@ -75,6 +75,9 @@ conf.registerGlobalValue(RSS, 'sortFeedItems',
|
|||||||
FeedItemSortOrder('asInFeed', _("""Determines whether feed items should be
|
FeedItemSortOrder('asInFeed', _("""Determines whether feed items should be
|
||||||
sorted by their update timestamp or kept in the same order as they appear
|
sorted by their update timestamp or kept in the same order as they appear
|
||||||
in a feed.""")))
|
in a feed.""")))
|
||||||
|
conf.registerGlobalValue(RSS, 'stripRedirect', registry.Boolean(
|
||||||
|
True, """Determines whether the bot will attempt to strip url redirection
|
||||||
|
from headline links, by taking things after the last http://."""))
|
||||||
|
|
||||||
conf.registerGlobalValue(RSS, 'feeds',
|
conf.registerGlobalValue(RSS, 'feeds',
|
||||||
FeedNames([], _("""Determines what feeds should be accessible as
|
FeedNames([], _("""Determines what feeds should be accessible as
|
||||||
|
@ -32,6 +32,7 @@ import time
|
|||||||
import types
|
import types
|
||||||
import socket
|
import socket
|
||||||
import threading
|
import threading
|
||||||
|
import re
|
||||||
|
|
||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
import supybot.utils as utils
|
import supybot.utils as utils
|
||||||
@ -145,9 +146,13 @@ class RSS(callbacks.Plugin):
|
|||||||
if self.registryValue(config, channel):
|
if self.registryValue(config, channel):
|
||||||
for headline in headlines:
|
for headline in headlines:
|
||||||
if headline[1]:
|
if headline[1]:
|
||||||
|
if self.registryValue('stripRedirect'):
|
||||||
|
h = re.sub('^.*http://', 'http://', headline[1])
|
||||||
|
else:
|
||||||
|
h = headline[1]
|
||||||
newheadlines.append(format('%s %u',
|
newheadlines.append(format('%s %u',
|
||||||
headline[0],
|
headline[0],
|
||||||
headline[1].encode('utf-8')))
|
h.encode('utf-8')))
|
||||||
else:
|
else:
|
||||||
newheadlines.append(format('%s', headline[0]))
|
newheadlines.append(format('%s', headline[0]))
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user