Я пытаюсь получить файл .csv с URL-адреса, когда oop через ссылки с использованием тега «a», href, который я хочу, не существует. как я могу получить его href.
` String URL = internalConstant.getMlcuURL();
String ffiListFile = null;
logger.info("Page URl: " + URL);
Document doc;
try {
doc = Jsoup.connect(URL).get();
Elements links = doc.select("a[href]");
for (Element link : links) {
logger.info("Elements aaaa"+ link);
String absHref = link.attr("abs:href");
if (absHref.endsWith(".csv")) {
logger.info(absHref);
ffiListFile = absHref;
break;
}
}
if (ffiListFile.isEmpty()) {
logger.error("file not found");
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "MLCU File not found in website");
}
this.fileDownloadFFIListService.downloadExcelFile(ffiListFile);
} catch (IOException e) {
e.printStackTrace();
logger.error("download error " + e.getMessage());
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Failed to download file");
`