Note: This article was translated with the assistance of AI. I wrote the original in Chinese. If you can read Chinese, you are welcome to read the original Chinese version for the most authentic and unfiltered expression.

Today I built a WeRead card generator, just for fun and as a coding exercise, so here’s a quick blog post about it. Star it if you like it.

shiquda/wereadcard (github.com)

Preview:

GitHub:

raw.githubusercontent.com/shiquda/wereadcard/main/output/recent_read.svg

If it doesn’t load, there’s also a mirror site:
raw.kkgithub.com/shiquda/wereadcard/main/output/recent_read.svg

Here’s a brief overview. Of course, I’d recommend checking out the GitHub repo directly—this version might be outdated.


Overview

This project uses GitHub Actions to automatically fetch your WeRead reading history and generate .svg cards for display.

Usage

Using GitHub Actions

Here’s one way to do it:

Go to https://weread.qq.com/ and scan the QR code to log in to WeRead.

Open the F12 developer console, go to the Network tab, refresh the page, filter by Fetch/XHR, select any request, find the Cookie in the Headers section, and copy the full string.

GitHub Configuration

  1. Fork this repository.
  2. In your repo, go to Settings > Secrets and variables > Actions and add a Repository secret:
  3. Required: WEREAD_COOKIE—paste the WeRead cookie string you copied in the previous step.
  4. Optional: BOOK_COUNT—defaults to 4, the number of books shown on the card. I’d recommend keeping it at 5 or fewer.
  5. Go to Settings > Actions > General, find Workflow permissions, switch it to Read and write permissions, and click Save.

Now GitHub Actions will automatically update the image every 8 hours and push it to the repo. You can find the updated card at /output/recent_read.svg.

You can also trigger Actions manually if you’d like.

On GitHub, open the image and the Raw link is your direct URL. If your network isn’t great, you can use a mirror site to speed things up—just replace githubusercontent with kkgithub in the URL, like this:

1
https://raw.githubusercontent.com/shiquda/wereadcard/main/output/recent_read.svg

Replace with:

1
https://raw.kkgithub.com/shiquda/wereadcard/main/output/recent_read.svg

Local Usage

Clone this repo and install the dependencies:

1
pip install -r requirements.txt

There are two ways to use it: you can configure the cookie and other parameters directly in main.py and run it, or use command-line arguments:

  • --cookie, -c: The cookie string—make sure to wrap it in quotes.
  • --number, -n: The number of books to display on the card.

After running, the generated card will be in the /output directory.

Acknowledgments