Skip to main content

A tool to export all you need to obsidian

Project description

Contributors Forks Stargazers Issues Licence Telegram

Export all your data into Obsidian

Your data is your asset, you should own it.

This tool exports your saved data to Markdown files for Obsidian.

  • Export data from many sites into local Markdown files.
  • Keep one simple CLI for all modules.
  • Write an optional index file in Markdown.

Now this tool had supported following modules:

  1. bangumi
  2. bilibili
  3. cnblog
  4. qireader
  5. v2ex
  6. weibo
  7. zhihu

Quick start

You can install from PyPI:

pipx install export_to_obsidian

Or install from this repo:

pipx install -e .

Put your token or cookie values in .env, then load them:

chmod +x ./export-env.sh
source ./export-env.sh

Main env vars used by the current modules:

  • CNBLOG_ACCESS_TOKEN
  • BGM_ACCESS_TOKEN
  • QIREADER_COOKIE
  • V2EX_ACCESS_TOKEN
  • V2EX_COOKIE
  • WEIBO_COOKIE
  • ZHIHU_COOKIE
  • BILIBILI_COOKIE

Basic usage

eto <command> [options]
eto --index-file <path> <command> [options]

--index-file is a top-level option. Put it before the subcommand.

If you do not use --index-file, the index is printed to the terminal.

If you use --index-file, the index is written to one Markdown file.

Each module is stored under one second-level heading, and repeated exports for the same module are appended in order under that same heading.

Command examples

cnblog

eto cnblog -o output/cnblog

bangumi

Use config/bangumi_template.md as the template file.

eto bangumi -t config/bangumi_template.md -s 1 -o output/bangumi
eto bangumi -t config/bangumi_template.md -s 2 -o output/bangumi
eto bangumi -t config/bangumi_template.md -s 3 -o output/bangumi
eto bangumi -t config/bangumi_template.md -s 4 -o output/bangumi

You can also set one collection type:

eto bangumi -t config/bangumi_template.md -s 2 -c 3 -o output/bangumi

-c means the status of the subject:

  • 1: 想看
  • 2: 看过
  • 3: 在看
  • 4: 搁置
  • 5: 抛弃

qireader

eto qireader -t your-tag -o output/qireader

v2ex

eto v2ex -o output/v2ex

zhihu

eto zhihu -c your-collection-id -o output/zhihu

weibo

eto weibo -u your-user-id -o output/weibo

bilibili

eto bilibili -f your-fav-id -o output/bilibili

Index file

Example:

eto --index-file output/index/export-index.md zhihu -c your-collection-id -o output/zhihu
eto --index-file output/index/export-index.md bilibili -f your-fav-id -o output/bilibili

The file is grouped by module name. One module keeps one ## section. Each export run adds one ### block under that module.

Example output:

## zhihu

- [[~zhihu-entry-1|First saved item]]
- [[~zhihu-entry-2|Second saved item]]

## bilibili

- [[~BV1xxxxxx|One saved video]]

Output

Files are written as Markdown files in your output folder. The project also writes front matter, so the files work well in Obsidian.

Testing

Run all tests:

PYTHONPATH=src pytest tests -q

Run one test file:

PYTHONPATH=src pytest tests/test_utils.py -q

In VS Code, you can also use the debug and test settings in .vscode/launch.json.

Contributing

Any contributions made are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'feat(module):add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Top contributors:

contrib.rocks image

License

All code is licensed under the AGPL-3.0 license. See LICENSE for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

export_to_obsidian-0.3.26.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

export_to_obsidian-0.3.26-py3-none-any.whl (55.6 kB view details)

Uploaded Python 3

File details

Details for the file export_to_obsidian-0.3.26.tar.gz.

File metadata

  • Download URL: export_to_obsidian-0.3.26.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.0 CPython/3.12.3 Linux/6.8.0-64-generic

File hashes

Hashes for export_to_obsidian-0.3.26.tar.gz
Algorithm Hash digest
SHA256 64e7e0b7b5a7590abf081602e190c4da5e6200cfb0f91876b275b3d7a90663ed
MD5 e2ee4435547bc683ff0e9b71bdbcdc31
BLAKE2b-256 fde7a06e0defed9e04a649db58399c88b37abbe9017a813286a1a13c1f08b544

See more details on using hashes here.

File details

Details for the file export_to_obsidian-0.3.26-py3-none-any.whl.

File metadata

  • Download URL: export_to_obsidian-0.3.26-py3-none-any.whl
  • Upload date:
  • Size: 55.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.0 CPython/3.12.3 Linux/6.8.0-64-generic

File hashes

Hashes for export_to_obsidian-0.3.26-py3-none-any.whl
Algorithm Hash digest
SHA256 990c4fc967c9e252f301bb16114d15a5a4c9a100697eda48cb910b4bcc8cb9b8
MD5 915b18b42c90cf31c8484214810c2c83
BLAKE2b-256 9ef5db8908ef02fd500c07b4b5ac6a960da4c9a2563ae9d29c66d002fcaac9a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page