Keep updating CSV export

Hello,

Is it possible to keep the CSV export updated as for Better Bibtex?

Is there a way to automate the CSV export when there is some changes in Zotero library?

Thanks
  • No, not available from the local client (something similar can be done using the server API). What's the use case?
  • I have a Python script which find in the CSV file the added items at a given date (in particular today), that's why I need the CSV file to be keep updated.
  • You can ask the BBT maintainer if he'd consider adding this, but if you're already in python I'd really do this via server API.
  • My Zotero library is too heavy to be sync online, so the API will not help me.
  • If you can't sync your library because of size (really? People sync libraries with >>100k items), then auto-export would impossibly slow down Zotero, so that wouldn't really be an option, either.
  • Oh yes sorry, it is just the PDF attachments which are not uploaded.

    How can I do that with the server API please?
  • Ok I used this code to print items by date added:

    from pyzotero import zotero
    zot = zotero.Zotero('library_id', 'library_type', 'api_key')
    zot.add_parameters(limit=5, sort='dateAdded')
    items = zot.top()
    for item in items:
    print('Item: %s | Key: %s | Date added: %s' % (item['data']['itemType'], item['data']['key'], item['data']['dateAdded']))

    But is there a way to return items on a specific date (without iterating and compare date-by-date)?
  • edited January 4, 2023
    But is there a way to return items on a specific date (without iterating and compare date-by-date)?
    No. Given what I understand you want, what I'd imagine you'd do is to retrieve items by date added, checking on the last date added until you've reached the last time you've reached the last time, (or until you're hitting the last item key you added) and then add those lines to the existing CSV file on the disk -- that's much more lightweight than re-writing the entire CSV every time, as auto-export would.
  • Exactly. And yes it is lightweight.

    But it is not like a SQL request where we can filter items between two dates, isn't it? I have to sort by date added as I did and then use an iterator to find the next item and check if its date added belongs to the slot of the two dates, right?
  • Correct, you have a limited set of query parameters for the API -- that's fairly typical to keep server load manageable. You could alternatively do (read-only) queries on the local sqlite database, but that involves a lot more parsing to get it into a reasonable format, of course .
  • The API makes it possible to efficiently get items changed since the last request — it's how syncing works. See ?since= and Last-Modified-Version.

    https://www.zotero.org/support/dev/web_api/v3/syncing
Sign In or Register to comment.