Initially, I just planned to whip up a small utility, use it for a couple of days, then forget about it (like most of my past projects). But it ended up saving me a ton of time without a single bug, and the more I used it, the smoother it felt.
Slowly, it sparked that old thought: “Why not just use SQLite?” Seriously, spinning up a MySQL instance every time is a real pain. So, this version came to be, finally freeing me from firing up a database service every time. (And it’s finally actually usable by humans, too.)
Usage
Project Link: https://github.com/yexca/PixivDownloader-SQLite
The GUI is similar to the previous generation; check out https://blog.yexca.net/archives/211/ for details.
Configuration
Before use, you need to configure:
refresh token(for Pixiv login authentication, refer to: Pixiv OAuth Flow )- Download path (default
D:\Downloads)
Download Instructions
After setup, simply input:
- Artist ID, or
- Artwork ID (if both are provided, only the Artist ID will be used)
Click ‘Download’ to fetch all works and log them to the database. For artists without existing records, all works will be downloaded. For artists with records, only un-downloaded works will be fetched.
Error Handling
Regarding program errors, only basic crawling error handling is implemented. If an error dialog pops up, it might be due to:
refresh tokennot configured or expired- Artist account does not exist
- Artwork does not exist
I haven’t provided specific error messages; if an error occurs, please check these three points.
For other errors (like the application crashing), please send me the latest file from program_root/logs/app_*-*-*.log and describe the issue.
Contact: PixivDownloader#yexca.net (replace @)
New Feature: From MySQL to SQLite
The biggest change is no longer needing your own MySQL setup; it now uses lightweight SQLite.
I then removed unnecessary database configs and consolidated settings with the Pixiv auth token.
Added an icon (just had ChatGPT draw one for fun), tweaked some UI styles – nothing major.
The code got some initial architectural structuring, though it ended up messy again by the end. (But who knows, maybe I’ll revisit it someday?)
Migrating from Old MySQL Database
While I doubt anyone used the previous version, I still need to explain this. Due to database structure differences, the best way to migrate is to query, export, and directly import. Here’s the query:
| |
Export the results in SQL INSERT format (I used Dataflare, which supports this).
Then, create a Python file and put in the following content:
| |
Replace the content within cursor.execute with your database backup. I’ve left three example records here.
Then, place the generated pixiv.db file into program_root/resources.
Some Dev Thoughts: From ‘Messy Code’ to ‘Understanding the Chaos’
Honestly, when I started this dev cycle, I really wanted to refactor the previous messy code. But as I worked on it, I realized exactly why it got so messy in the first place 😂
If anything, this refactor ended up even messier. Halfway through, I just thought, “Forget refactoring, I’ll just copy-paste it.” That led to the current mix of camelCase and snake_case, and honestly, I’m too tired to touch it anymore, sigh.
It’s pretty much a runnable, half-finished product, but hey, if it works, it works, right?~