public static void main(String[] args) {
String html = "<div id=\"lesson\" \n" +
" title=\"Лекция\" \n" +
" data-lesson-comment=\"\" \n" +
" data-lesson-id=\"342\" \n" +
" data-lesson-duration=\"2\" \n" +
" data-teacher-id=\"32\" \n" +
" data-curriculum-id=\"8892\" \n" +
" data-lesson-type=\"0\" \n" +
" data-corpus-id=\"2\" \n" +
" data-cabinet-id=\"72\"\n" +
" data-group-id=\"404\" \n" +
" data-undergroup=\"0\" \n" +
" style=\"background-color:#e5ffd5; text-shadow: #E6E6E6 0px 1px;\">\n" +
" <span class=\"ldur\">\n" +
" <span>\n" +
" 2ч\n" +
" </span>\n" +
" </span>\n" +
" Астрономия\n" +
" <span class=\"ugn\">\n" +
" </span>\n" +
" <br>\n" +
" Лекция\n" +
" <br>Крестниковская Е.А.\n" +
"</div>";
Document document = Jsoup.parse(html);
System.out.println((document.select("div").textNodes().get(1)));
}
public class Test {
public static void main(String[] args) {
String value = "!dsdsds 10.12.2022 ... 10.12.2022 mnmnm 20.01.2022 !dsdsds";
Pattern p = Pattern.compile("(\\d{2}.\\d{2}.\\d{4})");
Matcher matcher = p.matcher(value);
StringBuilder sb = new StringBuilder();
while (matcher.find()) {
sb.append(matcher.group());
sb.append(" ");
}
System.out.println(sb);
}
}
public class TicketsExtractor {
public List<Ticket> extractTickets(String html) {
List<WebElement> ticketElements = extractTicketsElements(html);
List<Ticket> tickets = new ArrayList<>();
for (WebElement ticketElement : ticketElements) {
Ticket ticket = extractTicketAttributes(ticketElement);
tickets.add(ticket);
}
return tickets;
}
List<WebElement> extractTicketsElements(String html) {
// extraction logic
return ticketElements;
}
Ticket extractTicketAttributes(WebElement ticketElement) {
Ticket ticket = new Ticket();
// extraction logic
return ticket;
}
class Ticket {
String id;
String title;
}
}
meta={'dont_redirect': True,"handle_httpstatus_list": [302]}