rss.lua: cleanRSS gefixt

This commit is contained in:
Akamaru 2016-07-20 21:01:08 +02:00
parent 47fbddf281
commit dff2efba46

View File

@ -78,17 +78,17 @@ function unescape_for_rss(str)
return str
end
function cleanRSS(cleantext)
cleantext = string.gsub(cleantext, '%[mehr%]', '')
cleantext = string.gsub(cleantext, '%[video%]', '')
cleantext = string.gsub(cleantext, '...%[more%]', '')
cleantext = string.gsub(cleantext, '%[more%]', '')
cleantext = string.gsub(cleantext, '%[phoenix%]', '')
cleantext = string.gsub(cleantext, 'Click for full.', '')
cleantext = string.gsub(cleantext, 'Read more »', '')
cleantext = string.gsub(cleantext, 'Meldung bei www.tagesschau.de lesen', '')
return cleantext
function cleanRSS(str)
str = string.gsub(str, '%[mehr%]', '')
str = string.gsub(str, '%[video%]', '')
str = string.gsub(str, '...%[more%]', '')
str = string.gsub(str, '%[more%]', '')
str = string.gsub(str, '%[phoenix%]', '')
str = string.gsub(str, 'Click for full.', '')
str = string.gsub(str, 'Read more »', '')
str = string.gsub(str, 'Read more', '')
str = string.gsub(str, 'Meldung bei www.tagesschau.de lesen', '')
return str
end
function get_base_redis(id, option, extra)
@ -344,20 +344,20 @@ function rss:cron(self_plz)
local link = v2.link or v2.id or 'Kein Link'
if v2.content then
if string.len(v2.content) > 250 then
content = string.sub(unescape_for_rss(v2.content:gsub("%b<>", "")), 1, 250) .. '...'
content = string.sub(unescape_for_rss(cleanRSS(v2.content):gsub("%b<>", "")), 1, 250) .. '...'
else
content = unescape_for_rss(v2.content:gsub("%b<>", ""))
content = unescape_for_rss(cleanRSS(v2.content):gsub("%b<>", ""))
end
elseif v2.summary then
if string.len(v2.summary) > 250 then
content = string.sub(unescape_for_rss(v2.summary:gsub("%b<>", "")), 1, 250) .. '...'
content = string.sub(unescape_for_rss(cleanRSS(v2.summary):gsub("%b<>", "")), 1, 250) .. '...'
else
content = unescape_for_rss(v2.summary:gsub("%b<>", ""))
content = unescape_for_rss(cleanRSS(v2.summary):gsub("%b<>", ""))
end
else
content = ''
end
content = cleanRSS(content)
text = text..'\n*[*#RSS*] '..title..'*\n'..utilities.trim(utilities.md_escape(content))..' [Weiterlesen]('..link..')\n'
end
if text ~= '' then