Do a lot of things
This commit is contained in:
@@ -3,7 +3,7 @@ import re
|
||||
from iwla import IWLA
|
||||
from iplugin import IPlugin
|
||||
|
||||
from awstats_robots_data import awstats_robots
|
||||
import awstats_data
|
||||
|
||||
class IWLAPreAnalysisRobots(IPlugin):
|
||||
def __init__(self, iwla):
|
||||
@@ -11,9 +11,7 @@ class IWLAPreAnalysisRobots(IPlugin):
|
||||
self.API_VERSION = 1
|
||||
|
||||
def load(self):
|
||||
global awstats_robots
|
||||
|
||||
self.awstats_robots = map(lambda (x) : re.compile(x, re.IGNORECASE), awstats_robots)
|
||||
self.awstats_robots = map(lambda (x) : re.compile(x, re.IGNORECASE), awstats_data.robots)
|
||||
|
||||
return True
|
||||
|
||||
@@ -32,13 +30,17 @@ class IWLAPreAnalysisRobots(IPlugin):
|
||||
if first_page['time_decoded'].tm_mday == super_hit['last_access'].tm_mday:
|
||||
for r in self.awstats_robots:
|
||||
if r.match(first_page['http_user_agent']):
|
||||
super_hit['robot'] = 1
|
||||
continue
|
||||
isRobot = True
|
||||
break
|
||||
|
||||
if isRobot:
|
||||
super_hit['robot'] = 1
|
||||
continue
|
||||
|
||||
# 1) no pages view --> robot
|
||||
if not super_hit['viewed_pages']:
|
||||
super_hit['robot'] = 1
|
||||
continue
|
||||
# if not super_hit['viewed_pages']:
|
||||
# super_hit['robot'] = 1
|
||||
# continue
|
||||
|
||||
# 2) pages without hit --> robot
|
||||
if not super_hit['viewed_hits']:
|
||||
@@ -59,6 +61,7 @@ class IWLAPreAnalysisRobots(IPlugin):
|
||||
super_hit['robot'] = 1
|
||||
continue
|
||||
|
||||
if super_hit['viewed_hits'] and not referers:
|
||||
if not super_hit['viewed_pages'] and \
|
||||
(super_hit['viewed_hits'] and not referers):
|
||||
super_hit['robot'] = 1
|
||||
continue
|
||||
|
Reference in New Issue
Block a user