diff --git a/CHANGELOG.md b/CHANGELOG.md index 20a39b0..de29b58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ ambiguous situations. ## Unreleased +## Fixed +- Crawling of exercises with instructions + ## 3.8.2 - 2025-04-29 ## Changed diff --git a/PFERD/crawl/ilias/kit_ilias_html.py b/PFERD/crawl/ilias/kit_ilias_html.py index 0a09ecc..105c606 100644 --- a/PFERD/crawl/ilias/kit_ilias_html.py +++ b/PFERD/crawl/ilias/kit_ilias_html.py @@ -975,16 +975,17 @@ class IliasPage: _unexpected_html_warning() return [] - individual_exercises = content_tab.find_all( - name="a", - attrs={ - "href": lambda x: x is not None - and "ass_id=" in x - and "cmdClass=ilAssignmentPresentationGUI" in x - } - ) + exercise_links = content_tab.select(".il-item-title a") + + for exercise in cast(list[Tag], exercise_links): + if "href" not in exercise.attrs: + continue + href = exercise.attrs["href"] + if type(href) is not str: + continue + if "ass_id=" not in href or "cmdclass=ilassignmentpresentationgui" not in href.lower(): + continue - for exercise in cast(list[Tag], individual_exercises): name = _sanitize_path_name(exercise.get_text().strip()) results.append(IliasPageElement.create_new( IliasElementType.EXERCISE,