|
@@ -17,6 +17,7 @@ import org.openqa.selenium.By;
|
|
import org.openqa.selenium.Cookie;
|
|
import org.openqa.selenium.Cookie;
|
|
import org.openqa.selenium.WebDriver;
|
|
import org.openqa.selenium.WebDriver;
|
|
import org.openqa.selenium.chrome.ChromeDriver;
|
|
import org.openqa.selenium.chrome.ChromeDriver;
|
|
|
|
+import org.openqa.selenium.chrome.ChromeDriverService;
|
|
import org.openqa.selenium.chrome.ChromeOptions;
|
|
import org.openqa.selenium.chrome.ChromeOptions;
|
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
@@ -24,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.IOException;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
@@ -191,7 +194,9 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
private String chromeDriver;
|
|
private String chromeDriver;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void adkuaishouWebLogin(String phone, String password) {
|
|
|
|
|
|
+ public void adkuaishouWebLogin(String phone, String password) throws IOException {
|
|
|
|
+ ChromeDriverService service = new ChromeDriverService.Builder().usingDriverExecutable(new File(chromeDriver)).usingAnyFreePort().build();
|
|
|
|
+ service.start();
|
|
System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
|
|
System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
|
|
ChromeOptions chromeOptions = new ChromeOptions();
|
|
ChromeOptions chromeOptions = new ChromeOptions();
|
|
WebDriver webDriver = new ChromeDriver(chromeOptions);
|
|
WebDriver webDriver = new ChromeDriver(chromeOptions);
|
|
@@ -243,12 +248,15 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
} finally {
|
|
} finally {
|
|
webDriver.quit();
|
|
webDriver.quit();
|
|
|
|
+ service.stop();
|
|
// HttpUtils.cookieStore.clear();
|
|
// HttpUtils.cookieStore.clear();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void getVideoList(String uid) {
|
|
|
|
|
|
+ public void getVideoList(String uid) throws IOException {
|
|
|
|
+ ChromeDriverService service = new ChromeDriverService.Builder().usingDriverExecutable(new File(chromeDriver)).usingAnyFreePort().build();
|
|
|
|
+ service.start();
|
|
System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
|
|
System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
|
|
ChromeOptions chromeOptions = new ChromeOptions();
|
|
ChromeOptions chromeOptions = new ChromeOptions();
|
|
WebDriver webDriver = new ChromeDriver(chromeOptions);
|
|
WebDriver webDriver = new ChromeDriver(chromeOptions);
|
|
@@ -290,6 +298,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
|
|
} finally {
|
|
} finally {
|
|
// HttpUtils.cookieStore.clear();
|
|
// HttpUtils.cookieStore.clear();
|
|
webDriver.quit();
|
|
webDriver.quit();
|
|
|
|
+ service.stop();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|