Omluvny list parser

This commit is contained in:
Thastertyn 2023-03-29 14:25:47 +02:00
parent ae9c652761
commit ccbaef8e5b
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
package xyz.thastertyn.JecnaParse;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import xyz.thastertyn.Tuple.Pair;
public class OmluvnyList {
private ArrayList<Pair<String, String>> data = new ArrayList<>();
private boolean wasDownloaded = false;
public void downloadOmluvnyList(final String JsessionId) throws UnknownHostException, IOException
{
Document doc = Downloader.download("https://www.spsejecna.cz/absence/student", JsessionId).get();
Elements omluv = doc.select("table.absence-list").select("tr");
for(Element e : omluv)
{
String date = e.child(0).text();
String text = e.child(1).text();
data.add(new Pair<String, String>(date, text));
}
wasDownloaded = true;
}
public ArrayList<Pair<String, String>> getData()
{
return data;
}
}