From 5f4e9fc3bdc173614f7c9ce0ac8bbe6aeb2703fc Mon Sep 17 00:00:00 2001 From: Akamaru Date: Wed, 19 Oct 2016 22:45:21 +0200 Subject: [PATCH] Revert commi 4f6abf917ef1134eabb78a4efaada0aece4ec9cf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iframely lässt ja nich so viele Anfragen zu... --- miku/plugins/rss.lua | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/miku/plugins/rss.lua b/miku/plugins/rss.lua index 20b8d8d..0cdea73 100644 --- a/miku/plugins/rss.lua +++ b/miku/plugins/rss.lua @@ -305,15 +305,6 @@ function rss:action(msg, config, matches) return end -function get_site_name(feed_link) --i know there's a better way to get this. But atm idc ¯\_(ツ)_/¯ - local iframely_api_key = cred_data.iframely_api_key - local res, code = https.request('https://iframe.ly/api/oembed?url='..feed_link..'&api_key='..iframely_api_key) - if code ~= 200 then return end - local data = json.decode(res) - local feed_name = data.provider_name - return feed_name -end - function rss:cron() local keys = redis:keys(get_base_redis("*", "subs")) for k,v in pairs(keys) do @@ -326,6 +317,11 @@ function rss:cron() if err ~= nil then return end + if not parsed.feed.title then + feed_title = parsed.feed.link + else + feed_title = parsed.feed.title + end local newentr = get_new_entries(last, parsed.entries) local subscribers = {} local text = '' -- Send one message per feed with the latest entries @@ -343,10 +339,6 @@ function rss:cron() end local link_name = link_name:gsub('^www%.', '') local link_name = link_name:gsub('^www1%.', '') - local site_title = get_site_name(link) - if not site_title then - site_title = link_name - end if v2.content then content = v2.content:gsub("%b<>", "") @@ -371,7 +363,7 @@ function rss:cron() else content = '' end - text = text..'\n[#RSS] '..title..'\n~ '..site_title..' ~\n'..utilities.trim(content)..'\nAuf '..link_name..' ansehen.\n' + text = text..'\n[#RSS] '..title..'\n~ '..feed_title..' ~\n'..utilities.trim(content)..'\nAuf '..link_name..' ansehen.\n' end if text ~= '' then local newlast = newentr[1].id