https://github.com/adlered/blogplatformexporttool
📄 博客平台备份文件的通用分析导出工具
https://github.com/adlered/blogplatformexporttool
Last synced: 5 months ago
JSON representation
📄 博客平台备份文件的通用分析导出工具
- Host: GitHub
- URL: https://github.com/adlered/blogplatformexporttool
- Owner: adlered
- License: gpl-3.0
- Created: 2020-05-14T12:48:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-24T01:41:03.000Z (over 5 years ago)
- Last Synced: 2025-08-08T07:32:52.924Z (5 months ago)
- Language: Java
- Homepage:
- Size: 1.01 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BlogPlatformExportTool
博客园、Typecho 等博客平台的通用导出工具
这个项目是为 [菠萝博客](https://github.com/adlered/bolo-solo) 项目写的轮子,支持将博客平台的备份文件提取并解析为数组,方便进行导出操作。
# 用法
将项目打包为 Jar,导入到你的项目当中。
首先,要在你的项目根目录下创建一个指定名称的目录(这里设置为根目录 temp 文件夹下的 file 文件夹)
将博客平台导出的备份文件放到该目录中
将该项目打包为 jar 包,引入到你的项目中([这里有已经打包好的提供下载](https://github.com/adlered/BlogPlatformExportTool/releases))
在项目中输入代码:
```
List list = run("CNBlogs", "temp/file");
```
方法解释:
```
run(String blogType, String dir)
```
blogType:以哪个平台的博客备份文件进行解析,目前支持 CNBlogs(博客园)
file:备份文件暂时存放的位置,你需要在项目根目录下创建同名文件夹,将备份的文件放进入,然后执行该方法对其进行导出
```
List list
```
TranslateResult 类为其中一篇文章的 Bean 方法,遍历 List,执行 TranslateResult 类的方法来获得每篇文章的导出详情
遍历示例:
```
for (TranslateResult i : result) {
System.out.println("标题:" + i.getTitle());
System.out.println("作者:" + i.getAuthor());
System.out.println("日期:" + i.getDate());
System.out.println("链接:" + i.getLink());
System.out.println("正文:" + i.getArticleContent());
}
```
另外还提供一个方便调试的方法,直接在控制台打印 run(String blogType, String dir) 方法导出的内容:
```
XML.printResult(list);
```