Add Go/Postgres admin APIs, Angular admin UI, manual build flow, asset uploads, markdown import/export, configurable slug generation, and the Yar reading theme. Exclude local docs and generated development artifacts from version control.
40 lines
1.1 KiB
Markdown
40 lines
1.1 KiB
Markdown
---
|
|
id: d45ebe08-3f81-474f-a284-93170d866f5a
|
|
slug: blog-transfer-complete
|
|
title: 博文转移完毕
|
|
summary: ""
|
|
status: published
|
|
tags: []
|
|
cover: ""
|
|
version: 1
|
|
slug_source: manual
|
|
slug_locked: true
|
|
published_at: "2023-02-24T00:56:03+08:00"
|
|
created_at: "2023-02-24T00:56:03+08:00"
|
|
updated_at: "2026-01-07T18:11:03+08:00"
|
|
---
|
|
|
|
由于之前的博客存储在了 sqlite3 数据库里,显然是没办法直接导入 Hexo 所识别的格式的,所以用 python 写了
|
|
一个小脚本,方便博文的转移。
|
|
|
|
```python
|
|
import sqlite3
|
|
from datetime import datetime
|
|
conn = sqlite3.connect("Hsunr.db")
|
|
cursor = conn.cursor()
|
|
|
|
cursor.execute('select * from post')
|
|
values = cursor.fetchall()
|
|
for item in values:
|
|
file_name = "{}-{}.md".format(item[5],item[1].replace(' ','-'))
|
|
dt_obj = datetime.strptime(item[0], '%Y%m%d%H%M%S')
|
|
content = "---\\n" \\
|
|
"title: {}\\n" \\
|
|
"date: {}\\n" \\
|
|
"tags:\\n" \\
|
|
"categories: {}\\n" \\
|
|
"---\\n"\\
|
|
"{}".format(item[1],dt_obj,item[3],item[2])
|
|
f = open(file_name,'w');
|
|
f.write(content)
|
|
```
|