Plugins OK
This commit is contained in:
@@ -30,10 +30,12 @@ def hook(hits):
|
||||
isRobot = False
|
||||
referers = 0
|
||||
|
||||
for r in awstats_robots:
|
||||
if r.match(super_hit['pages'][0]['http_user_agent']):
|
||||
super_hit['robot'] = 1
|
||||
continue
|
||||
first_page = super_hit['requests'][0]
|
||||
if first_page['time_decoded'].tm_mday == super_hit['last_access'].tm_mday:
|
||||
for r in awstats_robots:
|
||||
if r.match(first_page['http_user_agent']):
|
||||
super_hit['robot'] = 1
|
||||
continue
|
||||
|
||||
# 1) no pages view --> robot
|
||||
if not super_hit['viewed_pages']:
|
||||
@@ -45,7 +47,7 @@ def hook(hits):
|
||||
super_hit['robot'] = 1
|
||||
continue
|
||||
|
||||
for hit in super_hit['pages']:
|
||||
for hit in super_hit['requests']:
|
||||
# 3) /robots.txt read
|
||||
if hit['extract_request']['http_uri'] == '/robots.txt':
|
||||
isRobot = True
|
||||
|
@@ -7,9 +7,11 @@ PLUGIN_CLASS = 'HTTP'
|
||||
API_VERSION = 1
|
||||
|
||||
def get_plugins_infos():
|
||||
infos = {'class' : PLUGIN_CLASS,
|
||||
'min_version' : API_VERSION,
|
||||
'max_version' : -1}
|
||||
infos = {
|
||||
'class' : PLUGIN_CLASS,
|
||||
'min_version' : API_VERSION,
|
||||
'max_version' : -1
|
||||
}
|
||||
return infos
|
||||
|
||||
def load():
|
||||
@@ -23,9 +25,10 @@ def hook(hits):
|
||||
|
||||
if super_hit['robot']: continue
|
||||
|
||||
for p in super_hit['pages']:
|
||||
for p in super_hit['requests']:
|
||||
if not p['is_page']: continue
|
||||
if int(p['status']) != 200: continue
|
||||
if p['time_decoded'].tm_mday != super_hit['last_access'].tm_mday: continue
|
||||
if logo_re.match(p['extract_request']['extract_uri']):
|
||||
p['is_page'] = False
|
||||
super_hit['viewed_pages'] -= 1
|
||||
|
Reference in New Issue
Block a user