summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-05-01 18:01:11 +0200
committerAki <please@ignore.pl>2021-05-01 18:01:11 +0200
commit00d10a6594125ddca8c17acbee8d2f022910f2ae (patch)
treef1171abcf3583c85707d7803980e4aa4159520f7
parenta984f8887cf42d3819bd713a33ca562d4711ef6f (diff)
downloadfield-00d10a6594125ddca8c17acbee8d2f022910f2ae.zip
field-00d10a6594125ddca8c17acbee8d2f022910f2ae.tar.gz
field-00d10a6594125ddca8c17acbee8d2f022910f2ae.tar.bz2
Fixed duplicates in teams
-rw-r--r--scrap.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/scrap.py b/scrap.py
index c28b1c0..07e4036 100644
--- a/scrap.py
+++ b/scrap.py
@@ -70,13 +70,12 @@ def main():
related.feed(page)
killmails = []
- teams = ([], [])
+ teams = (set(), set())
for team, kill, owner in related.kills:
time.sleep(1.05) # Zkillboard is very sensitive.
killmails.append({"id": int(kill), "hash": get_hash(kill)})
destination = teams[team - 1]
- if owner not in destination:
- destination.append(int(owner))
+ destination.add(int(owner))
if args.output:
filename = args.output
@@ -88,7 +87,7 @@ def main():
filename = "scrapped.json"
with open(filename, "w") as file:
- file.write(json.dumps({"killmails": killmails, "teams": teams}))
+ file.write(json.dumps({"killmails": killmails, "teams": tuple(map(list, teams))}))
if __name__ == "__main__":