summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/Reaktor/plugins.nix
diff options
context:
space:
mode:
authorlassulus <lass@lassul.us>2017-01-21 22:05:02 +0100
committerlassulus <lass@lassul.us>2017-01-21 22:05:02 +0100
commit94631f688c8e7418f4f0a06c70e06b203e43bd5f (patch)
treef99e7a46dd01836ef11405c3132e89e00e4f2f2e /krebs/5pkgs/Reaktor/plugins.nix
parentcc789a85d8a4de5c6505a24917b635822dc1ed96 (diff)
k 5 Reaktor plugins: add url-title
Diffstat (limited to 'krebs/5pkgs/Reaktor/plugins.nix')
-rw-r--r--krebs/5pkgs/Reaktor/plugins.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/krebs/5pkgs/Reaktor/plugins.nix b/krebs/5pkgs/Reaktor/plugins.nix
index a483db32c..3e48ae3ba 100644
--- a/krebs/5pkgs/Reaktor/plugins.nix
+++ b/krebs/5pkgs/Reaktor/plugins.nix
@@ -116,4 +116,16 @@ rec {
commands.insert(0,titlebot_cmd('clear'))
'';
};
+
+ url-title = (buildSimpleReaktorPlugin "url-title" {
+ pattern = "^.*(?P<args>http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)$$";
+ path = with pkgs; [ wget perl ];
+ script = pkgs.writeDash "lambda-pl" ''
+ if [ "$#" -gt 0 ]; then
+ exec wget -qO- "$1" |
+ perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)(?: - youtube)?\s*<\/title/si'
+ fi
+ '';
+ });
+
}