调整WebClient代码
This commit is contained in:
parent
84c583ad38
commit
af9be86762
@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class QQBotApplication {
|
public class QQBotApplication {
|
||||||
public static final String version="QQBot v.1.2.25";
|
public static final String version="QQBot v.1.2.26";
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("version = " + version);
|
System.out.println("version = " + version);
|
||||||
SpringApplication.run(QQBotApplication.class, args);
|
SpringApplication.run(QQBotApplication.class, args);
|
||||||
|
@ -13,14 +13,9 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class WebClient {
|
public class WebClient {
|
||||||
private static WebClient client;
|
|
||||||
|
|
||||||
|
|
||||||
public static WebClient getInstance() {
|
public static WebClient getInstance() {
|
||||||
if (client == null) {
|
return new WebClient();
|
||||||
client = new WebClient();
|
|
||||||
}
|
|
||||||
return client;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebDriver getWebDriver() {
|
public WebDriver getWebDriver() {
|
||||||
@ -59,20 +54,23 @@ public class WebClient {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
static boolean headless=false;
|
|
||||||
public static void setHeadless(boolean headless){
|
static boolean headless = false;
|
||||||
WebClient.headless=headless;
|
|
||||||
|
public void setHeadless(boolean headless) {
|
||||||
|
WebClient.headless = headless;
|
||||||
}
|
}
|
||||||
public static ChromeOptions getOptions() {
|
|
||||||
|
public ChromeOptions getOptions() {
|
||||||
ChromeOptions options = new ChromeOptions();
|
ChromeOptions options = new ChromeOptions();
|
||||||
// options.addArguments("--disable-gpu");
|
// options.addArguments("--disable-gpu");
|
||||||
// options.addArguments("blink-settings=imagesEnabled=false");
|
// options.addArguments("blink-settings=imagesEnabled=false");
|
||||||
String headless = RedisTools.get("chromedrive_headless");
|
String headless = RedisTools.get("chromedrive_headless");
|
||||||
String proxy=RedisTools.get("chromedrive_proxy");
|
String proxy = RedisTools.get("chromedrive_proxy");
|
||||||
if("true".equals(proxy)) {
|
if ("true".equals(proxy)) {
|
||||||
options.addArguments("--proxy-server=http://127.0.0.1:7890");
|
options.addArguments("--proxy-server=http://127.0.0.1:7890");
|
||||||
}
|
}
|
||||||
if("true".equals(headless)||WebClient.headless) {
|
if ("true".equals(headless) || WebClient.headless) {
|
||||||
options.addArguments("--headless");
|
options.addArguments("--headless");
|
||||||
}
|
}
|
||||||
options.addArguments("--no-sandbox");
|
options.addArguments("--no-sandbox");
|
||||||
|
Loading…
Reference in New Issue
Block a user