diff options
-rwxr-xr-x | wnpp-query.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/wnpp-query.py b/wnpp-query.py index 704e282..97abb2d 100755 --- a/wnpp-query.py +++ b/wnpp-query.py @@ -47,7 +47,7 @@ for line in url: line = line.strip() link = re.sub('<ul>', '', line) - link = line[14:43] + link = line[13:42] item.append(link) name = re.sub('<ul>', '', line) @@ -58,7 +58,7 @@ for line in url: if options.description: try: description = re.sub('</a>,', '', line) - description = ' (' + description.split(':')[2] + ')' + description = ' (' + description.split(':')[2].strip() + ')' except: description = '' item.append(description) @@ -75,6 +75,7 @@ for line in url: else: if re.match('^requested yesterday\.$', line): days = '1' + elif re.match('^requested today\.$', line): days = '0' else: days = line.split(' ')[1] item.append(days) @@ -83,7 +84,8 @@ for line in url: reports.append(item) item = [] +reports.sort(key = lambda x: x[3]) for entry in reports: if int(entry[3]) <= options.max_days_old \ and int(entry[3]) >= options.min_days_old: - print entry[1] + entry[2] + ': ' + entry[3] + ' days ago (' + entry[0] + ')' + print entry[3], 'days ago:', entry[1], entry[0], entry[2] |