Essen auswählen

Stand jetzt: essen von der Website gezogen: Schöner: Warten auf API-Key
This commit is contained in:
Jonas Braus
2024-11-24 14:35:44 +01:00
parent d3a211efb9
commit f870be4af7
7 changed files with 243 additions and 94 deletions
+22
View File
@@ -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;
}
}