diff --git a/miku/plugins/rss.lua b/miku/plugins/rss.lua
index ce29f2b..20b8d8d 100644
--- a/miku/plugins/rss.lua
+++ b/miku/plugins/rss.lua
@@ -305,6 +305,15 @@ 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
@@ -317,11 +326,6 @@ 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
@@ -339,6 +343,10 @@ 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<>", "")
@@ -363,7 +371,7 @@ function rss:cron()
else
content = ''
end
- text = text..'\n[#RSS] '..title..'\n'..feed_title..'\n'..utilities.trim(content)..'\nAuf '..link_name..' ansehen.\n'
+ text = text..'\n[#RSS] '..title..'\n~ '..site_title..' ~\n'..utilities.trim(content)..'\nAuf '..link_name..' ansehen.\n'
end
if text ~= '' then
local newlast = newentr[1].id