only run on collection
This commit is contained in:
parent
8ca2e0cd63
commit
24685b853e
1 changed files with 12 additions and 1 deletions
|
@ -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']
|
||||
|
|
Loading…
Reference in a new issue