aperezdc / luabot

An XMPP (Jabber) bot written in Lua using the protocol implementation from Verse/Prosody

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

urltitles: Allow postprocessing of extracted titles

aperezdc opened this issue · comments

Some web pages may have information in their titles that is not desirable to echo back. Take as example URL:

for which the title echoed back by the plugin is:

Issue 1415093003: [css-grid] Child's logicalWidth computation must determine inline margins - Code Review

The title includes the - Code Review suffix, which is redundant information. It would be desirable that the urltitles plugin allows some way of postprocessing titles after extracting them from the HTML pages.

A tentative idea for configuring this could be assigning a function to URL inclusion patters in the configuration file. For the example URL above, the following would work:

plugin "urltitles" {
   include = {
      ["^https://codereview%.chromium%.org/%d+/"] = function (title)
         return title:sub(1, -15)
      end;
   };
}