From 873f5487ac57c5958a3f273d1b8e8d7dcf8b3591 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Thu, 2 May 2024 20:09:45 +0900 Subject: [PATCH] =?utf8?q?Pixiv=E3=81=8B=E3=82=89=E3=83=80=E3=82=A6?= =?utf8?q?=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E5=87=BA=E6=9D=A5=E3=82=8B?= =?utf8?q?=E6=A7=98=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + main.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 953ed16..90001ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * 画像は大き過ぎるの場合、画面に合うまで小さくにする様に * 「Q」キーを押すと、終了する様に * サイズ変更の修正 +* Pixivからダウンロード出来る様に # 0.4.0 * URLから画像ファイルを開ける様に diff --git a/main.c b/main.c index cd5449c..300f39c 100644 --- a/main.c +++ b/main.c @@ -39,6 +39,15 @@ bool dlfile(const char* url, const char* filename) { CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/102.0" ); + // Pixivも結構面倒くさい + if ( + strstr("s.pixiv.net", url) == 0 || + strstr("i.pixiv.net", url) == 0 || + strstr("s.pximg.net", url) == 0 || + strstr("i.pximg.net", url) == 0 + ) { + curl_easy_setopt(curl, CURLOPT_REFERER, "https://www.pixiv.net/"); + } curl_easy_setopt(curl, CURLOPT_WRITEDATA, file); CURLcode res = curl_easy_perform(curl); fclose(file); -- 2.43.0