mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-12 15:35:05 +02:00
Initial work on ILIAS7-support. Basic ('normal') elements seem to work.
This commit is contained in:
parent
a82a0b19c2
commit
e49caa4877
3 changed files with 8 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,6 +3,7 @@
|
||||||
/PFERD.egg-info/
|
/PFERD.egg-info/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
/.vscode/
|
/.vscode/
|
||||||
|
/.idea/
|
||||||
|
|
||||||
# pyinstaller
|
# pyinstaller
|
||||||
/pferd.spec
|
/pferd.spec
|
||||||
|
|
|
||||||
|
|
@ -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())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue