iwla

iwla Commit Details

Date:2015-01-13 18:54:22 (6 years 6 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:9d3f7c05a4a4a1a5756e500df2cb306bf7aac790
Parents: 3fb1b897eaa39d917137b545c795f98a35325774
Message:Optimize top_downloads post analysis plugin

Changes:
Mplugins/post_analysis/top_downloads.py (2 diffs)

File differences

plugins/post_analysis/top_downloads.py
5353
5454
5555
56
5756
5857
59
58
6059
6160
62
63
64
6561
6662
6763
68
6964
7065
7166
......
7570
7671
7772
78
79
80
81
82
83
84
73
74
8575
8676
8777
def __init__(self, iwla):
super(IWLAPostAnalysisTopDownloads, self).__init__(iwla)
self.API_VERSION = 1
self.conf_requires = ['multimedia_files', 'viewed_http_codes']
def hook(self):
stats = self.iwla.getCurrentVisists()
stats = self.iwla.getValidVisitors()
month_stats = self.iwla.getMonthStats()
multimedia_files = self.iwla.getConfValue('multimedia_files')
viewed_http_codes = self.iwla.getConfValue('viewed_http_codes')
top_downloads = month_stats.get('top_downloads', {})
for (k, super_hit) in stats.items():
if super_hit['robot']: continue
for r in super_hit['requests'][::-1]:
if not self.iwla.isValidForCurrentAnalysis(r):
break
uri = r['extract_request']['extract_uri'].lower()
isMultimedia = False
for ext in multimedia_files:
if uri.endswith(ext):
isMultimedia = True
break
if isMultimedia: continue
if self.iwla.isMultimediaFile(uri):
continue
uri = "%s%s" % (r.get('server_name', ''),
r['extract_request']['extract_uri'])

Archive Download the corresponding diff file

Branches

Tags