Update webstats_common.lua

pull/462/head
midoks 2 years ago
parent 2f48df6013
commit 093f8b14f8
  1. 14
      plugins/webstats/lua/webstats_common.lua

@ -890,15 +890,19 @@ function _M.match_spider(self, ua)
end
-- Curl|Yahoo|HeadlessChrome|包含bot|Wget|Spider|Crawler|Scrapy|zgrab|python|java|Adsbot|DuckDuckGo
find_spider, _ = ngx.re.match(ua, "(Yahoo|Slurp|DuckDuckGo)", "ijo")
if res then
find_spider, _ = ngx.re.match(ua, "(Yahoo|Slurp|DuckDuckGo|Semrush|Bot)", "ijo")
if find_spider then
spider_match = string.lower(find_spider[0])
if string.find(spider_match, "yahoo", 1, true) then
spider_name = "yahoo"
spider_name = "other"
elseif string.find(spider_match, "slurp", 1, true) then
spider_name = "yahoo"
spider_name = "other"
elseif string.find(spider_match, "duckduckgo", 1, true) then
spider_name = "duckduckgo"
spider_name = "other"
elseif string.find(spider_match, "Semrush", 1, true) then
spider_name = "other"
elseif string.find(spider_match, "bot", 1, true) then
spider_name = "other"
end
return true, spider_name, spider_table[spider_name]
end

Loading…
Cancel
Save