Initial work on ILIAS7-support. Basic ('normal') elements seem to work.

This commit is contained in:
Shirkanesi 2022-01-05 21:52:00 +01:00
parent a82a0b19c2
commit e49caa4877
No known key found for this signature in database
GPG key ID: D0A80177131377F7
3 changed files with 8 additions and 5 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
/PFERD.egg-info/ /PFERD.egg-info/
__pycache__/ __pycache__/
/.vscode/ /.vscode/
/.idea/
# pyinstaller # pyinstaller
/pferd.spec /pferd.spec

View file

@ -133,7 +133,7 @@ class IliasPage:
# parse it # parse it
json_object = json.loads(json_str) json_object = json.loads(json_str)
streams = [stream for stream in json_object["streams"] if stream["type"] == "video"] streams = [stream for stream in json_object["streams"] if stream["content"] == "presentation"]
# and just fetch the lone video url! # and just fetch the lone video url!
if len(streams) == 1: if len(streams) == 1:
@ -390,12 +390,14 @@ class IliasPage:
# but some JS later transforms them into an accordion. # but some JS later transforms them into an accordion.
# This is for these weird JS-y blocks # This is for these weird JS-y blocks
if "ilContainerItemsContainer" in parent.get("class"): if "il_ContainerItemTitle" in parent.get("class"):
# I am currently under the impression that *only* those JS blocks have an # I am currently under the impression that *only* those JS blocks have an
# ilNoDisplay class. # ilNoDisplay class.
if "ilNoDisplay" not in parent.get("class"): if "ilNoDisplay" not in parent.get("class"):
continue continue
prev: Tag = parent.findPreviousSibling("div") prev: Tag = parent.findPreviousSibling("div")
if not prev.get("class"):
continue
if "ilContainerBlockHeader" in prev.get("class"): if "ilContainerBlockHeader" in prev.get("class"):
found_titles.append(prev.find("h3").getText().strip()) found_titles.append(prev.find("h3").getText().strip())

View file

@ -610,9 +610,9 @@ instance's greatest bottleneck.
@staticmethod @staticmethod
def _is_logged_in(soup: BeautifulSoup) -> bool: def _is_logged_in(soup: BeautifulSoup) -> bool:
# Normal ILIAS pages # Normal ILIAS pages -- not sure if this will work on every page...
userlog = soup.find("li", {"id": "userlog"}) userlog = soup.find("span", {"class": "glyphicon-login"})
if userlog is not None: if userlog is None:
return True return True
# Video listing embeds do not have complete ILIAS html. Try to match them by # Video listing embeds do not have complete ILIAS html. Try to match them by
# their video listing table # their video listing table