From 6e211474c96d75a878c2cf15991828789047bdf3 Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Sat, 14 Jan 2017 14:25:00 +0100 Subject: [PATCH] Fixe Amazon-Plugin mit einigen URLs (warum hat Amazon so verdammt viele verschiedene Produkt-URLs?) --- otouto/plugins/amazon_cleaner.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/otouto/plugins/amazon_cleaner.lua b/otouto/plugins/amazon_cleaner.lua index 52080fb..a6a4f7d 100644 --- a/otouto/plugins/amazon_cleaner.lua +++ b/otouto/plugins/amazon_cleaner.lua @@ -19,7 +19,12 @@ function cln_amzn:action(msg, config, matches) local ok, response_code, response_headers = http.request(request_constructor) local long_url = response_headers.location - local domain, product_id = long_url:match('amazon.(%w+)/gp/product/(.+)/(.+)') + if not long_url then return end + local domain, product_id = long_url:match('amazon.(%w+)/gp/product/(.+)/.+') + if not product_id then + domain, product_id = long_url:match('amazon.(%w+)/.+/dp/(.+)/') + end + if not product_id then return end utilities.send_reply(msg, 'Ohne Ref: https://amazon.'..domain..'/dp/'..product_id) return end