diff --git a/cleanup/add_date.py b/cleanup/add_date.py index cc8080e..b51476b 100644 --- a/cleanup/add_date.py +++ b/cleanup/add_date.py @@ -14,11 +14,22 @@ import dateparser import ox.api api = ox.api.signin('https://archive.leftove.rs/api/') +if len(sys.argv) > 1: + collection = sys.argv[1] + query = { + 'conditions': [ + {'key': 'collection', 'operator': '==', 'value': collection} + ] + } +else: + query = {} + + if os.path.exists('titles.json'): titles = json.load(open('titles.json')) else: titles = api.findDocuments({ - 'query': {}, + 'query': query, 'keys': ['id', 'title', 'date'], 'range': [0, 15000] })['data']['items']