Essen auswählen
Stand jetzt: essen von der Website gezogen: Schöner: Warten auf API-Key
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class FetchMenu {
|
||||
static Future<List<String>> get() async {
|
||||
List<String> menus = [];
|
||||
|
||||
// TODO: Proto:
|
||||
http.Response resp = await http.get(Uri.parse(
|
||||
"https://www.swfr.de/essen/mensen-cafes-speiseplaene/mensa-loerrach"));
|
||||
var content = resp.body.split("<h3>");
|
||||
var innerContent = content[1].split("\n");
|
||||
for (var s in innerContent) {
|
||||
if (s.contains("extra-text mb-15px")) {
|
||||
var name = (s.split("\">")[1].split("</")[0]).replaceAll("<br>", " ");
|
||||
menus.add(name);
|
||||
}
|
||||
}
|
||||
// End-Proto
|
||||
|
||||
return menus;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user