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/
__pycache__/
/.vscode/
/.idea/
# pyinstaller
/pferd.spec

View file

@ -133,7 +133,7 @@ class IliasPage:
# parse it
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!
if len(streams) == 1:
@ -390,12 +390,14 @@ class IliasPage:
# but some JS later transforms them into an accordion.
# 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
# ilNoDisplay class.
if "ilNoDisplay" not in parent.get("class"):
continue
prev: Tag = parent.findPreviousSibling("div")
if not prev.get("class"):
continue
if "ilContainerBlockHeader" in prev.get("class"):
found_titles.append(prev.find("h3").getText().strip())

View file

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