222
This commit is contained in:
parent
0a2e896962
commit
2788e2db2a
@ -41,6 +41,7 @@ import java.io.InputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
/**
|
||||
* 亚马逊爬虫控制器 - 爬取价格和卖家信息
|
||||
@ -98,7 +99,7 @@ public class WebMagicController extends BaseController implements PageProcessor
|
||||
private void loadProxyConfig() {
|
||||
try {
|
||||
//File configFile = ResourceUtils.getFile("classpath:test_proxy.yml");
|
||||
File configFile = new File("/www/java_mall/erp/config/test_proxy.yml");
|
||||
File configFile = new File("/www/java_mall/erp/config/test_proxy.yml");
|
||||
if (configFile.exists()) {
|
||||
Yaml yaml = new Yaml();
|
||||
try (InputStream inputStream = new FileInputStream(configFile)) {
|
||||
@ -168,7 +169,6 @@ public class WebMagicController extends BaseController implements PageProcessor
|
||||
@Override
|
||||
public void process(Page page) {
|
||||
try {
|
||||
System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
Html html = page.getHtml();
|
||||
String priceSymbol = html.xpath("//span[@class='a-price-symbol']/text()").toString();
|
||||
String priceWhole = html.xpath("//span[@class='a-price-whole']/text()").toString();
|
||||
@ -311,10 +311,9 @@ public class WebMagicController extends BaseController implements PageProcessor
|
||||
try {
|
||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
|
||||
.get(3, TimeUnit.SECONDS);
|
||||
} catch (Exception e) {
|
||||
logger.debug("等待代理测试完成时发生异常", e);
|
||||
} catch (TimeoutException te) {
|
||||
logger.debug("等待代理测试完成超时,这是正常现象");
|
||||
}
|
||||
|
||||
for (CompletableFuture<Map<String, Object>> future : futures) {
|
||||
try {
|
||||
if (future.isDone() && !future.isCompletedExceptionally()) {
|
||||
|
@ -40,7 +40,7 @@
|
||||
class="action-button"
|
||||
>开始爬取</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="3">
|
||||
<el-col :span="3">
|
||||
<el-button
|
||||
type="info"
|
||||
plain
|
||||
@ -49,7 +49,7 @@
|
||||
@click="openProxyDialog"
|
||||
class="action-button"
|
||||
>选择代理</el-button>
|
||||
</el-col>-->
|
||||
</el-col>
|
||||
<el-col :span="15">
|
||||
<div class="notice-box" v-if="asinList.length > 0">
|
||||
已导入 <span class="count-number">{{asinList.length}}</span> 个ASIN
|
||||
@ -724,7 +724,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
this.startProxyTest(); // 直接开始测试,不弹确认框
|
||||
this.startProxyTest();
|
||||
},
|
||||
|
||||
/** 开始测试代理节点 */
|
||||
@ -788,6 +788,8 @@ export default {
|
||||
proxyNode.testing = false;
|
||||
}
|
||||
});
|
||||
|
||||
this.saveProxyDelaysToCache();
|
||||
},
|
||||
|
||||
/** 处理测试错误 */
|
||||
@ -804,6 +806,8 @@ export default {
|
||||
});
|
||||
|
||||
this.$message.warning('部分代理测试失败,继续测试下一批');
|
||||
// 保存当前已测试的延迟数据
|
||||
this.saveProxyDelaysToCache();
|
||||
setTimeout(() => {
|
||||
this.testNextBatch(batches, batchIndex + 1);
|
||||
}, 500);
|
||||
|
Loading…
x
Reference in New Issue
Block a user