From 7b5a3dd92ebb47f01e5cd007a379bc565e4712d7 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Tue, 11 Feb 2014 09:38:39 +1100 Subject: [PATCH] Treat data as text, not json. --- mirror_fetchers.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mirror_fetchers.py b/mirror_fetchers.py index 9ff3c27..faa7570 100755 --- a/mirror_fetchers.py +++ b/mirror_fetchers.py @@ -1,7 +1,6 @@ #!/usr/bin/python import datetime -import json import os import urllib @@ -49,11 +48,11 @@ while day < datetime.datetime.now(): merged_data = [] with open(single, 'r') as f: for line in f.readlines(): - single_data.append(json.loads(line)) + single_data.append(line) if os.path.exists(merged): with open(merged, 'r') as f: for line in f.readlines(): - merged_data.append(json.loads(line)) + merged_data.append(line) new_entries = 0 for entry in single_data: @@ -62,7 +61,7 @@ while day < datetime.datetime.now(): new_entries += 1 with open(merged, 'w') as f: - f.write(json.dumps(merged_data)) + f.write('\n'.join(merged_data)) print ('%s ... merged (%d new entries)' % (datetime.datetime.now(), new_entries))