extractRegularEventDetails function
Implementation
RegularCalendarEventDetails extractRegularEventDetails(BeautifulSoup soup) {
List<Content> contents = [];
String? note;
var contentContainer =
soup.find("*", id: "s_m_Content_Content_tocAndToolbar_inlineHomeworkDiv");
var noteContainer =
soup.find("*", id: 's_m_Content_Content_tocAndToolbar_ActNoteTB_tb');
if (noteContainer != null) {
note = noteContainer.text;
}
if (contentContainer != null && contentContainer.children.isNotEmpty) {
if (contentContainer.children[0].text ==
"Aktiviteten har ikke noget indhold.") {
return RegularCalendarEventDetails(note, "");
}
List<Bs4Element> homework = contentContainer.findAll("article");
for (var homeworkPiece in homework) {
contents.addAll(extractHomeworkArticle(homeworkPiece));
}
}
var content =
soup.find('*', id: 's_m_Content_Content_tocAndToolbar_inlineHomeworkDiv');
return RegularCalendarEventDetails(note, content?.innerHtml ?? "");
}