2022-05-13 18:14:52 +00:00
# BookStack-Python-exporter
Customizable script for exporting notes from BookStack through API
2022-05-13 18:44:05 +00:00
2022-05-13 19:12:38 +00:00
#### Features:
- export keeping the tree structure by making folders from Shelves, Books and Chapters
- export multiple formats at once
2022-06-22 14:03:40 +00:00
- export at multiple levels at once (export Books or/and Chapters or/and Pages as files)
2022-05-13 19:12:38 +00:00
- customizable path for placing exported notes
- authorization token is loaded from txt file
Requirements:
- Python at least in version 3.6
2022-05-13 18:44:05 +00:00
Full example on how to use the script:
1. Clone the repo
2. next to the script place token.txt file containing token id and token secret in format: TOKEN_ID:TOKEN_SECRET
2022-06-22 14:03:40 +00:00
3. in the same directory run the command, specifying your app domain with https prefix (every parameter is optional as it have default value, this is a full possible example):
2022-05-13 18:44:05 +00:00
```bash
2022-06-22 14:03:40 +00:00
python exporter.py \
-H https://wiki.example.com \
-f pdf,md,plaintext,html \
-l pages,chapters,books
-t ./token.txt \
2022-06-23 11:50:06 +00:00
-V debug \
2022-06-22 14:03:40 +00:00
-p ./
2022-05-13 18:44:05 +00:00
```
Customization:
```text
2022-06-23 11:50:06 +00:00
options:
2022-05-13 18:44:05 +00:00
-p PATH, --path PATH Path where exported files will be placed.
Default: .
-t TOKEN_FILE, --token-file TOKEN_FILE
File containing authorization token in format TOKEN_ID:TOKEN_SECRET
Default: ./token.txt
-H HOST, --host HOST Your domain with protocol prefix, example: https://example.com
Default: https://localhost
-f FORMATS, --formats FORMATS
2022-06-23 11:50:06 +00:00
Coma separated list of formats to use for export.
Available ones: markdown,plaintext,pdf,html
default: markdown
2022-06-22 14:03:40 +00:00
-l LEVEL, --level LEVEL
Coma separated list of levels at which should be export performed.
Available levels: ['pages', 'chapters', 'books']
Default: pages
2022-06-23 11:50:06 +00:00
-V LOG_LEVEL, --log-level LOG_LEVEL
Set verbosity level.
Available levels: dict_keys(['debug', 'info', 'warning', 'error'])
Default: info
2022-06-22 14:03:40 +00:00
2022-05-13 18:44:05 +00:00
```
### TODO:
2022-06-23 11:50:06 +00:00
- ~~choosing verbosity level through command line parameter~~ Done
2022-06-22 14:03:40 +00:00
- ~~choosing on what level should the notes be exported (Books, Chapters, Pages)~~ Done
2022-06-23 11:50:06 +00:00
- WIP: choosing if update note file only if the last edit timestamp from API is later that the local file timestamp
2022-05-13 18:44:05 +00:00
- suggestions?