diff --git a/src/main/java/net/lamgc/cgj/pixiv/PixivDownload.java b/src/main/java/net/lamgc/cgj/pixiv/PixivDownload.java
index b04da49..7c0f6df 100644
--- a/src/main/java/net/lamgc/cgj/pixiv/PixivDownload.java
+++ b/src/main/java/net/lamgc/cgj/pixiv/PixivDownload.java
@@ -505,45 +505,7 @@ public class PixivDownload {
/**
* 获取作品信息
* @param illustId 作品ID
- * @return 成功获取返回JsonObject, 失败返回null,
- * Json示例:
- *
- * { - * "illustId": "79584670", - * "illustTitle": "このヤンキーはウブすぎる", - * "id": "79584670", - * "title": "このヤンキーはウブすぎる", - * "illustType": 1, - * "xRestrict": 0, - * "restrict": 0, - * "sl": 2, - * "url": "https://i.pximg.net/c/360x360_70/img-master/img/2020/02/19/00/38/23/79584670_p0_square1200.jpg", - * "description": "", - * "tags": [ - * "漫画", - * "オリジナル", - * "創作", - * "創作男女", - * "コロさん、ポリさん此方です!", - * "恋の予感", - * "あまずっぺー", - * "交換日記", - * "続編希望!!", - * "オリジナル10000users入り" - * ], - * "userId": "4778293", - * "userName": "隈浪さえ", - * "width": 3288, - * "height": 4564, - * "pageCount": 4, - * "isBookmarkable": true, - * "bookmarkData": null, - * "alt": "#オリジナル このヤンキーはウブすぎる - 隈浪さえ的漫画", - * "isAdContainer": false, - * "profileImageUrl": "https://i.pximg.net/user-profile/img/2019/12/04/18/56/19/16639046_fea29ce38ea89b0cb2313b40b3a72f9a_50.jpg", - * "type": "illust" - * } - *+ * @return 成功获取返回JsonObject, 失败返回null. * @throws IOException 当请求发生异常, 或接口返回错误信息时抛出. * @throws NoSuchElementException 当该作品不存在时抛出异常 */ diff --git a/src/main/java/net/lamgc/cgj/proxy/PixivAccessProxyServer.java b/src/main/java/net/lamgc/cgj/proxy/PixivAccessProxyServer.java deleted file mode 100644 index 2e9d533..0000000 --- a/src/main/java/net/lamgc/cgj/proxy/PixivAccessProxyServer.java +++ /dev/null @@ -1,149 +0,0 @@ -package net.lamgc.cgj.proxy; - -import com.github.monkeywie.proxyee.intercept.HttpProxyIntercept; -import com.github.monkeywie.proxyee.intercept.HttpProxyInterceptInitializer; -import com.github.monkeywie.proxyee.intercept.HttpProxyInterceptPipeline; -import com.github.monkeywie.proxyee.intercept.common.CertDownIntercept; -import com.github.monkeywie.proxyee.proxy.ProxyConfig; -import com.github.monkeywie.proxyee.server.HttpProxyServer; -import com.github.monkeywie.proxyee.server.HttpProxyServerConfig; -import io.netty.channel.Channel; -import io.netty.handler.codec.http.HttpHeaderNames; -import io.netty.handler.codec.http.HttpHeaders; -import io.netty.handler.codec.http.HttpRequest; -import io.netty.handler.codec.http.HttpResponse; -import org.apache.http.client.CookieStore; -import org.apache.http.impl.cookie.BasicClientCookie; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.HttpCookie; -import java.util.Date; -import java.util.List; - -/** - * 登录成功后提供CookieStore, 然后由程序自动登录Pixiv - * @author LamGC - */ -public class PixivAccessProxyServer { - - private final Logger log = LoggerFactory.getLogger(PixivAccessProxyServer.class); - - private final HttpProxyServer proxyServer; - - private final CookieStore cookieStore; - - public PixivAccessProxyServer(CookieStore cookieStore){ - this(cookieStore, null); - } - - public PixivAccessProxyServer(CookieStore cookieStore, ProxyConfig proxyConfig){ - HttpProxyServerConfig config = new HttpProxyServerConfig(); - this.cookieStore = cookieStore; - config.setHandleSsl(true); - this.proxyServer = new HttpProxyServer(); - this.proxyServer - .serverConfig(config) - .proxyConfig(proxyConfig) - .proxyInterceptInitializer(new HttpProxyInterceptInitializer(){ - @Override - public void init(HttpProxyInterceptPipeline pipeline) { - pipeline.addLast(new CertDownIntercept()); - pipeline.addLast(new HttpProxyIntercept(){ - - private boolean match(HttpRequest request){ - String host = request.headers().get(HttpHeaderNames.HOST); - return host.equalsIgnoreCase("pixiv.net") || host.contains(".pixiv.net"); - } - - @Override - public void beforeRequest(Channel clientChannel, HttpRequest httpRequest, HttpProxyInterceptPipeline pipeline) throws Exception { - log.info("URL: " + httpRequest.headers().get(HttpHeaderNames.HOST) + httpRequest.uri()); - if(!match(httpRequest)){ - super.beforeRequest(clientChannel, httpRequest, pipeline); - return; - } - log.info("正在注入Cookies..."); - HttpHeaders requestHeaders = httpRequest.headers(); - if(requestHeaders.contains(HttpHeaderNames.COOKIE)){ - log.info("原请求存在自带Cookies, 正在清除Cookies..."); - log.debug("原Cookies: {}", requestHeaders.getAsString(HttpHeaderNames.COOKIE)); - requestHeaders.remove(HttpHeaderNames.COOKIE); - } - StringBuilder cookieBuilder = new StringBuilder(); - cookieStore.getCookies().forEach(cookie -> { - if(cookie.isExpired(new Date())){ - return; - } - cookieBuilder.append(cookie.getName()).append("=").append(cookie.getValue()).append("; "); - }); - log.info("Cookies构造完成, 结果: " + cookieBuilder.toString()); - requestHeaders.add(HttpHeaderNames.COOKIE, cookieBuilder.toString()); - log.info("Cookies注入完成."); - - super.beforeRequest(clientChannel, httpRequest, pipeline); - } - - @Override - public void afterResponse(Channel clientChannel, Channel proxyChannel, HttpResponse httpResponse, HttpProxyInterceptPipeline pipeline) throws Exception { - if(!match(pipeline.getHttpRequest())){ - super.afterResponse(clientChannel, proxyChannel, httpResponse, pipeline); - return; - } - log.info("正在更新Response Cookie...(Header Name: " + HttpHeaderNames.SET_COOKIE + ")"); - List