# Trilium2typecho **Repository Path**: gkm0/trilium2typecho ## Basic Information - **Project Name**: Trilium2typecho - **Description**: trilium笔记自动同步到typecho - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: https://guokm.cn/YGBkpNgWi6x3.html - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-10-18 - **Last Updated**: 2024-10-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 1. ## 介绍 ​ 此脚本为将trilium笔记某些分类下的笔记自动同步到typecho博客对应的分类下。并且可以将图片内容自动同步到博客usr/uploads/{noteid}/{附件id}下,无需重复上传。 ​ 首次使用会自动创建一个sync文件,用以保存已同步的noteid 使用教程:[trilium笔记按照分类自动同步为typecho对应分类文章 - 懒猫爱伸腰 (guokm.cn)](https://guokm.cn/YGBkpNgWi6x3.html) ## 准备 1. 安装python 2. 安装trilium_py依赖: ``` bat pip install trilium_py ``` 还需要以下依赖: import os import pymysql import time from bs4 import BeautifulSoup import requests ## 配置 记事本或其他编辑器打开trilium2typecho.py,编辑以下内容: ``` python server_url = '' # 你的trilium服务器地址 token = '' # 你的ETAPI token category_notes = [ {'noteid': 'o1689FuJ0VSN', 'mid': '1'}, #分类笔记的id和typecho的分类id {'noteid': 'LaaK7xJkrKiD', 'mid': '2'}, \# 有其他分类可以继续按上行格式添加 ] # typecho的数据库信息 db_config = { 'host': 'localhost', # 数据库地址 'user': 'guokm', # 数据库用户名 'password ': '123456', # 数据库密码 'database': 'guokm' # 数据库名 } ``` ## 使用 将此脚本放到typecho根目录目录下运行 ``` bat python trilium2typecho.py ``` 同步markdown文章需要在开始加 ```bat ```