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:
If it doesn’t load, there’s also a mirror site:
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
Getting Your Cookie
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
- Fork this repository.
- In your repo, go to
Settings > Secrets and variables > Actionsand add aRepository secret: - Required:
WEREAD_COOKIE—paste the WeRead cookie string you copied in the previous step. - Optional:
BOOK_COUNT—defaults to4, the number of books shown on the card. I’d recommend keeping it at5or fewer. - Go to
Settings > Actions > General, findWorkflow permissions, switch it toRead and write permissions, and clickSave.
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.
Getting the Direct Image Link
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.