From fc59271149ee08682ae35a2c3b55aa936fd8ec77 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:10:58 +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 b55b2ed..0f53157 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 0.3.0 * CDNの回避 +* Pixivからダウンロード出来る様に # 0.2.0 * ファイル名はパラメートルを付いたら、ファイル名は拡張子に diff --git a/main.c b/main.c index 8fde87c..dc31376 100644 --- a/main.c +++ b/main.c @@ -135,6 +135,15 @@ int downloader(CURL* curl, char* filename, const char* url) { 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