Metadata-Version: 2.1
Name: thu-learn-downloader
Version: 0.3.0
Summary: Download everything from Web Learning of Tsinghua University
Home-page: https://github.com/liblaf/thu-learn-downloader
License: MIT
Author: liblaf
Author-email: i@liblaf.me
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: beautifulsoup4 (>=4.12.2,<5.0.0)
Requires-Dist: pydantic (>=2.4.2,<3.0.0)
Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
Requires-Dist: requests (>=2.31.0,<3.0.0)
Requires-Dist: rich (>=13.6.0,<14.0.0)
Requires-Dist: tenacity (>=8.2.3,<9.0.0)
Requires-Dist: typer (>=0.9.0,<0.10.0)
Project-URL: Repository, https://github.com/liblaf/thu-learn-downloader
Description-Content-Type: text/markdown

# THU Web Learning Downloader

Download everything from Web Learning of Tsinghua University

[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/liblaf/thu-learn-downloader/ci.yaml)](https://github.com/liblaf/thu-learn-downloader/actions/workflows/ci.yaml)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/thu-learn-downloader)](https://pypi.org/project/thu-learn-downloader/)
[![PyPI - Version](https://img.shields.io/pypi/v/thu-learn-downloader)](https://pypi.org/project/thu-learn-downloader/)

## Demo

![Demo](https://github.com/liblaf/thu-learn-downloader/raw/assets/demo.png)

The resulting file structure looks like:

```
thu-learn
└── Quantum Mechanics(1)
   ├── docs
   │  └── 电子教案
   │     ├── 01-0量子力学介绍1.pdf
   │     └── 04-0量子力学介绍2.pdf
   └── work
      └── 01-第一周作业
         ├── attach-第一周作业.pdf
         ├── submit-第一周作业.pdf
         └── README.md
```

## Usage

**Usage**:

```console
$ tld [OPTIONS]
```

**Options**:

- `-u, --username TEXT`
- `-p, --password TEXT`
- `--prefix DIRECTORY`: [default: $HOME/thu-learn]
- `-s, --semester TEXT`: [default: 2023-2024-1]
- `-c, --course TEXT`
- `--document / --no-document`: [default: document]
- `--homework / --no-homework`: [default: homework]
- `-j, --jobs INTEGER`: [default: 8]
- `-l, --language [en|zh]`: [default: en]
- `--log-level [NOTSET|DEBUG|INFO|WARNING|ERROR|CRITICAL]`: [env var: LOG_LEVEL; default: INFO]
- `--help`: Show this message and exit.

## Features

- fast concurrent download
- pretty TUI powered by [rich](https://github.com/Textualize/rich)
- auto set `mtime` of downloaded files according to timestamp of remote file
- auto skip download when local file is newer
- dump homework details into `README.md` in each homework folder
- pretty markdown files powered by [prettier](https://prettier.io) (require `prettier` installed)

## Installation

- download pre-built binary form [GitHub Releases](https://github.com/liblaf/thu-learn-downloader/releases)
- `pip install thu-learn-downloader`
- `pipx install thu-learn-downloader`

