Omluvny list parser
This commit is contained in:
parent
ae9c652761
commit
ccbaef8e5b
40
src/main/java/xyz/thastertyn/JecnaParse/OmluvnyList.java
Normal file
40
src/main/java/xyz/thastertyn/JecnaParse/OmluvnyList.java
Normal 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;
|
||||
}
|
||||
}
|
BIN
target/classes/xyz/thastertyn/JecnaParse/OmluvnyList.class
Normal file
BIN
target/classes/xyz/thastertyn/JecnaParse/OmluvnyList.class
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user