mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
a0ae9aee27 | |||
1486a63854 | |||
733e1ae136 | |||
4ac51048c1 | |||
f2aba970fd |
@ -37,7 +37,7 @@ Ensure that you have at least Python 3.8 installed.
|
|||||||
To install PFERD or update your installation to the latest version, run this
|
To install PFERD or update your installation to the latest version, run this
|
||||||
wherever you want to install or have already installed PFERD:
|
wherever you want to install or have already installed PFERD:
|
||||||
```
|
```
|
||||||
$ pip install git+https://github.com/Garmelon/PFERD@v2.4.2
|
$ pip install git+https://github.com/Garmelon/PFERD@v2.4.3
|
||||||
```
|
```
|
||||||
|
|
||||||
The use of [venv] is recommended.
|
The use of [venv] is recommended.
|
||||||
@ -60,8 +60,8 @@ $ mkdir Vorlesungen
|
|||||||
$ cd Vorlesungen
|
$ cd Vorlesungen
|
||||||
$ python3 -m venv .venv
|
$ python3 -m venv .venv
|
||||||
$ .venv/bin/activate
|
$ .venv/bin/activate
|
||||||
$ pip install git+https://github.com/Garmelon/PFERD@v2.4.2
|
$ pip install git+https://github.com/Garmelon/PFERD@v2.4.3
|
||||||
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.4.2/example_config.py
|
$ curl -O https://raw.githubusercontent.com/Garmelon/PFERD/v2.4.3/example_config.py
|
||||||
$ python3 example_config.py
|
$ python3 example_config.py
|
||||||
$ deactivate
|
$ deactivate
|
||||||
```
|
```
|
||||||
|
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import find_packages, setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="PFERD",
|
name="PFERD",
|
||||||
version="2.4.2",
|
version="2.4.3",
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"requests>=2.21.0",
|
"requests>=2.21.0",
|
||||||
|
16
sync_url.py
16
sync_url.py
@ -5,7 +5,10 @@ A simple script to download a course by name from ILIAS.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from pathlib import Path
|
import os
|
||||||
|
import re
|
||||||
|
from pathlib import Path, PurePath
|
||||||
|
from typing import Optional
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from PFERD import Pferd
|
from PFERD import Pferd
|
||||||
@ -15,6 +18,14 @@ from PFERD.ilias import (IliasCrawler, IliasElementType,
|
|||||||
from PFERD.utils import to_path
|
from PFERD.utils import to_path
|
||||||
|
|
||||||
|
|
||||||
|
def sanitize_path(path: PurePath) -> Optional[PurePath]:
|
||||||
|
# Escape windows illegal path characters
|
||||||
|
if os.name == 'nt':
|
||||||
|
sanitized_parts = [re.sub(r'[<>:"/|?]', "_", x) for x in list(path.parts)]
|
||||||
|
return PurePath(*sanitized_parts)
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--test-run", action="store_true")
|
parser.add_argument("--test-run", action="store_true")
|
||||||
@ -59,7 +70,8 @@ def main() -> None:
|
|||||||
target=folder,
|
target=folder,
|
||||||
full_url=args.url,
|
full_url=args.url,
|
||||||
cookies=args.cookies,
|
cookies=args.cookies,
|
||||||
dir_filter=dir_filter
|
dir_filter=dir_filter,
|
||||||
|
transform=sanitize_path
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user