From 94631f688c8e7418f4f0a06c70e06b203e43bd5f Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 21 Jan 2017 22:05:02 +0100 Subject: k 5 Reaktor plugins: add url-title --- krebs/5pkgs/Reaktor/plugins.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'krebs') 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 = "^.*(?Phttp[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 /\s*(.*?)(?: - youtube)?\s*<\/title/si' + fi + ''; + }); + } -- cgit v1.2.3