k 5 Reaktor plugins url-title: timeout after 5s

This commit is contained in:
lassulus 2017-01-22 12:53:15 +01:00
parent 8d527f99be
commit 42b3396858

View File

@ -119,10 +119,10 @@ rec {
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 ];
path = with pkgs; [ curl perl ];
script = pkgs.writeDash "lambda-pl" ''
if [ "$#" -gt 0 ]; then
exec wget -qO- "$1" |
curl -SsL --max-time 5 "$1" |
perl -l -0777 -ne 'print $1 if /<title.*?>\s*(.*?)(?: - youtube)?\s*<\/title/si'
fi
'';