summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/Reaktor
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-01-25 23:23:29 +0100
committermakefu <github@syntax-fehler.de>2017-01-25 23:23:29 +0100
commitbf405736962fd20df738f84665e5fc7f8d74e72d (patch)
treeae01054fe88089d6476b3c1b1952066fd6c79092 /krebs/5pkgs/Reaktor
parent7e1bd2729e11e5c63749c69093359de0bb3329b2 (diff)
parent89c5b22129d3cb875d16a3171a4e3ab3bee9cb0a (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/5pkgs/Reaktor')
-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..d4774dd69 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; [ curl perl ];
+ script = pkgs.writeDash "lambda-pl" ''
+ if [ "$#" -gt 0 ]; then
+ curl -SsL --max-time 5 "$1" |
+ perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)(?: - youtube)?\s*<\/title/si'
+ fi
+ '';
+ });
+
}