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
|
import ox.api
|
||||||
api = ox.api.signin('https://archive.leftove.rs/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'):
|
if os.path.exists('titles.json'):
|
||||||
titles = json.load(open('titles.json'))
|
titles = json.load(open('titles.json'))
|
||||||
else:
|
else:
|
||||||
titles = api.findDocuments({
|
titles = api.findDocuments({
|
||||||
'query': {},
|
'query': query,
|
||||||
'keys': ['id', 'title', 'date'],
|
'keys': ['id', 'title', 'date'],
|
||||||
'range': [0, 15000]
|
'range': [0, 15000]
|
||||||
})['data']['items']
|
})['data']['items']
|
||||||
|
|
Loading…
Reference in a new issue