Blog-Update-Fetching-Script
Blog Update Fetching Script
Introduction
This is an automation script I implemented in the Hexo blog update to automatically fetch blog updates, compare them with previous update statuses, and allow users to manually determine the update status of unfinished and newly added blogs, thus obtaining the new blog update status.
All Blogs are classified into three major categories:
⏸️(Still working)
✅(Mostly finished)
❌(Barely completed)
Preliminaries
For the latest version, you need to get the Absolute address of your hexo
directories which stores all your Markdown files and replace it with the variable of BLOG_DIR
.
For example, in main.py
:
1 |
|
Usage
For the new version
You can run the original python scripts:
1 |
|
And you will see the answers and the output! Go to Demo for more details.
Or you can run the bash scripts run.sh
to achieve more refined output control!
1 |
|
For the old version (not recommended)
In main.sh
, change the directory into your own directory:
1 |
|
Then create a new dir containing logs.
1 |
|
You need to initialize prev.txt
for your own blog!
For this document, please maintain the following format: Each line should include a prefix status emoji and the title name. The prefix status emojis include ✅ and ❌, indicating the completion status of the blog.
An example text is as follows:
1 |
|
Please ensure that your output structure maintains alphabetical order. You can use the following command line to achieve this:
1 |
|
You only need to initialize it once! The scripts will update it later.
For Hexo Blog users, the directory which stores your Blog posts may be like as follows:
- Several
.md
files - Several directories which has the same name with
.md
files
The main.sh
will automatically get all file names using the grep
command:
1 |
|
grep -v ".*\.sh"
is because I add several.sh
files into it. You can modify it with your own needs.
Then, the file will compare the new status with the previous status stored in the prev.txt
. Then the file will ask users to manually determine the update status of unfinished and newly added blogs.
Finally, the scripts will update prev.txt
and generate a new blog status named 20250330_200559.txt
and you can see the updated status there!
Demo
Enjoy Coding
Discussion
Just for fun, and just for hexo
users.
Welcome PRs.