Skip to content

Commit

Permalink
Reto mouredev#18 - java
Browse files Browse the repository at this point in the history
  • Loading branch information
espinoleandroo committed Nov 15, 2023
1 parent 62128b3 commit ad782a7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Retos/Reto #18 - WEB SCRAPING [Difícil]/java/EspinoLeandroo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;

public class EspinoLeandroo {

public static void main(String[] args) {
String url = "https://holamundo.day";

try {
Document doc = Jsoup.connect(url).get();

// Encuentra la sección de la agenda del día 8
Elements agendaItems = doc.select("div.agenda-day-8 div.agenda-item");

// Itera sobre los elementos de la agenda e imprime la hora e información
for (Element item : agendaItems) {
String hora = item.select("span.agenda-hour").text();
String informacion = item.select("span.agenda-info").text();
System.out.println(hora + " | " + informacion);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

0 comments on commit ad782a7

Please sign in to comment.