爬虫3开发

This commit is contained in:
vivid 2025-07-17 17:03:04 +08:00
parent 3544c44293
commit 25512187f8
2 changed files with 7 additions and 6 deletions

View File

@ -18,19 +18,16 @@ public class Spider3Controller {
@Resource
private ObjectMapper objectMapper;
@Value("${quanguo.url}")
@Value("${spider3.url}")
private String SPIDER_URL;
@Value("${quanguo.api-key}")
@Value("${spider3.api-key}")
private String API_KEY;
@PostMapping("/run")
public JSONObject run(@RequestBody SpiderDto dto) throws JsonProcessingException {
dto.setLlm_api_key(API_KEY);
String body = objectMapper.writeValueAsString(dto);
public JSONObject run() throws JsonProcessingException {
return WebClient.create(SPIDER_URL).post().uri("/start_crawl")
.contentType(MediaType.APPLICATION_JSON)
.bodyValue(body)
.retrieve()
.bodyToMono(JSONObject.class)
.block();

View File

@ -87,3 +87,7 @@ quanguo:
url: http://${QUANGUO_HOST:47.112.173.8:6806/api/v1}
api-key: ${QUANGUO_API_KEY:77c068fd-d5b6-4c33-97d8-db5511a09b26}
spider3:
url: http://${QUANGUO_HOST:47.112.173.8:6257/api/v1}
api-key: ${QUANGUO_API_KEY:77c068fd-d5b6-4c33-97d8-db5511a09b26}