Today I created a WeChat Reading Card Generator as a hobby and practice. I wrote a blog post about it. Welcome to Star.
shiquda/wereadcard (github.com)
Demo:
github:
If it doesn't load, there is also a mirror site:
Here is the introduction. Of course, it is recommended to go to Github to view it directly, as the version here may be outdated.
Introduction#
This project uses Github Actions to automatically fetch WeChat Reading records and generate .svg
cards for display.
Usage#
Using Github Actions#
Getting the cookie#
Here is just one method:
Go to https://weread.qq.com/, scan the QR code to log in to WeChat Reading.
Use the F12
console tool, open Network, refresh the page, filter Fetch/XHR, select any request, then find the Cookie in the Headers section, and copy the corresponding string.
Github configuration#
- Fork this repository.
- In your repository, go to
Settings > Secrets and variables > Actions
, and addRepository secrets
: - [Required]:
WEREAD_COOKIE
, add the WeChat Reading cookie string copied in the previous step. - [Optional]:
BOOK_COUNT
, default is4
, the number of books displayed in the image, it is recommended not to exceed5
. - Go to
Settings > Actions > General
, findWorkflow permissions
, change it toRead and write permissions
, and clickSave
.
Now Github Actions will update the image every 8 hours by default, and push it to the repository. The updated card can be found in /output/recent_read.svg
.
Of course, you can also manually trigger Actions.
Getting the direct link to the image#
In GitHub, go to the image, Raw
corresponds to the direct link. If the network environment is not good, you can consider using a mirror site for acceleration by replacing githubusercontent
in the URL with kkgithub
, like this:
Replace it with
Local usage#
Clone this repository, then install the dependencies:
There are two ways to use it: you can directly configure the cookie and other parameters in main.py
, and then run it directly, or use command line parameters:
--cookie, -c
: cookie string, make sure to add quotes around the string.--number, -n
: the number of books in the generated card.
After running, the generated card can be found in the /output
directory.