added date getting
This commit is contained in:
parent
326d1decae
commit
74fb1b504c
85
src/Date.java
Normal file
85
src/Date.java
Normal file
@ -0,0 +1,85 @@
|
||||
import javafx.scene.input.DataFormat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Date {
|
||||
private int index = 0;
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
ArrayList<String> listnew = new ArrayList<>();
|
||||
public String nextDate;
|
||||
|
||||
|
||||
public void getdata() {
|
||||
|
||||
GregorianCalendar now = new GregorianCalendar();
|
||||
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM); // 14.04.2012
|
||||
String datum = df.format(now.getTime());
|
||||
|
||||
URL url = null;
|
||||
try {
|
||||
url = new URL("https://www.steyr.at/system/web/kalender.aspx?vdatum=" + datum + "&bdatum=12.10.2019&typ=&typid=0&typids=225781950&detailonr=0&menuonr=225781812");
|
||||
Scanner scanner = new Scanner(new InputStreamReader(url.openStream()));
|
||||
|
||||
int n = 0;
|
||||
while (scanner.hasNext()) {
|
||||
String temp = scanner.next();
|
||||
addList(temp);
|
||||
}
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Filter();
|
||||
}
|
||||
|
||||
private void addList(String temp) {
|
||||
list.add(index, temp);
|
||||
}
|
||||
|
||||
public void printList() {
|
||||
for (int n = 0; n < listnew.size(); n++) {
|
||||
System.out.println(listnew.get(n));
|
||||
}
|
||||
}
|
||||
|
||||
private void Filter() {
|
||||
String temp = "href=\"/system/web/kalender.aspx?detailonr=225781954-6&menuonr=225781812\">Hausabfall";
|
||||
int counter = 0;
|
||||
|
||||
for (int n = 0; n < list.size(); n++) {
|
||||
if (list.get(n).equals(temp)) {
|
||||
counter++;
|
||||
|
||||
if (counter == 4) {
|
||||
|
||||
int zaehler = 0;
|
||||
|
||||
for (int v = n; v < list.size(); v++) {
|
||||
listnew.add(zaehler, list.get(v));
|
||||
zaehler++;
|
||||
}
|
||||
|
||||
String string = "004-034556";
|
||||
String[] parts = string.split("-");
|
||||
String part1 = parts[0]; // 004
|
||||
String part2 = parts[1]; // 034556
|
||||
|
||||
for (int q = 0; q < listnew.size(); q++) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,14 @@
|
||||
public class main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
Date D=new Date();
|
||||
D.getdata();
|
||||
D.printList();
|
||||
/*
|
||||
Thread mythread = new Thread(() -> new Webserver().startserver());
|
||||
mythread.start();
|
||||
System.out.println("thread started");
|
||||
|
||||
|
||||
System.out.println("thread started");*/
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user