Skip to content

Commit

Permalink
Merge branch 'dev' into 'master'
Browse files Browse the repository at this point in the history
Merge features from dev to master

See merge request tgeorg/vo-scraper!9
  • Loading branch information
gteufelberger committed Oct 5, 2020
2 parents 1f019f7 + 741f4fd commit 757e77d
Show file tree
Hide file tree
Showing 4 changed files with 336 additions and 71 deletions.
82 changes: 82 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
image: python:3.8-slim

stages:
- pre-test
- basic-download-test
- feature-test

python-compile-test:
stage: pre-test
script:
# Check whether script is syntax error free
- python3 -m py_compile vo-scraper.py

ensure-same-version:
stage: pre-test
script:
# Ensure verion numbers in `VERSION` and `vo-scraper.py` match
- grep -q $(sed -n "s/^.*program_version = '\(.*\)'$/\1/p" vo-scraper.py) VERSION

# Download unprotected video
unprotected-recording:
stage: basic-download-test
needs: [python-compile-test]
script:
# Install dependency
- pip3 install requests
# Download video
- python3 vo-scraper.py --disable-hints --hide-progress-bar --quality low --latest https://video.ethz.ch/lectures/d-infk/2020/spring/252-0028-00L.html
# Compare checksums
- echo $(sha1sum Lecture\ Recordings/Digital\ Design\ and\ Computer\ Architecture/2020-03-12_low-3ebf562d.mp4) | grep -q f80bcc1c215cebf64a4da7f9623406fb1309e512

# Download 'PWD' protected video
pwd-protected-recording:
stage: basic-download-test
needs: [python-compile-test]
script:
# Install dependency
- pip3 install requests
# Download video
- python3 vo-scraper.py --disable-hints --hide-progress-bar --quality low --latest --file $PWD_LINK_FILE
# Compare checksums
- echo $(sha1sum Lecture\ Recordings/Introduction\ to\ Machine\ Learning/2020-05-27\ -\ Tutorial_low-1898f0cc.mp4) | grep -q dce9f9aeb00693b6dbce49b113c10d2f84a29b70

# Download 'ETH' protected video
eth-protected-recording:
stage: basic-download-test
needs: [python-compile-test]
script:
# Install dependency
- pip3 install requests
# Download video
- python3 vo-scraper.py --disable-hints --hide-progress-bar --quality low --latest --file $ETH_LINK_FILE
# Compare checksums
- echo $(sha1sum Lecture\ Recordings/Advanced\ Systems\ Lab/2020-03-19_low-fd29952f.mp4) | grep -q efd4a1779a29da08c0186ed6121fc10bfa7e8e83

# Test default named parameter file
default-parameter-file:
stage: feature-test
needs: [unprotected-recording]
script:
# Install dependency
- pip3 install requests
# Add parameter file
- printf -- "--quality low\n--latest\n--hide-progress-bar\n--disable-hints\n" > parameters.txt
# Download video
- python3 vo-scraper.py https://video.ethz.ch/lectures/d-infk/2020/spring/252-0028-00L.html
# Compare checksums
- echo $(sha1sum Lecture\ Recordings/Digital\ Design\ and\ Computer\ Architecture/2020-03-12_low-3ebf562d.mp4) | grep -q f80bcc1c215cebf64a4da7f9623406fb1309e512

# Test custom named parameter file
custom-parameter-file:
stage: feature-test
needs: [unprotected-recording]
script:
# Install dependency
- pip3 install requests
# Add parameter file
- printf -- "--quality low\n--latest\n--hide-progress-bar\n--disable-hints\n" > parameters2.txt
# Download video
- python3 vo-scraper.py --parameter-file parameters2.txt https://video.ethz.ch/lectures/d-infk/2020/spring/252-0028-00L.html
# Compare checksums
- echo $(sha1sum Lecture\ Recordings/Digital\ Design\ and\ Computer\ Architecture/2020-03-12_low-3ebf562d.mp4) | grep -q f80bcc1c215cebf64a4da7f9623406fb1309e512
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# vo-scraper
# vo-scraper 🎓🎥

A python script for ETH students to download lecture videos from [video.ethz.ch](https://video.ethz.ch/).

Expand Down Expand Up @@ -48,6 +48,18 @@ You may find this example of ranges useful:
| `1..3..` | `1 3 5 [...]` | Every other episodes starting from the second (i.e.. all the second episodes of the week) |
| `..3..` | `0 3 6 [...]` | Every third episodes, starting from the beginning |

### Q: Can I use it to download live streams?

#### A: No

Downloading live streams is not supported.

### Q: Can I use it to download lecture recordings from other platforms (e.g. Zoom)?

#### A: No

Downloading is only supported for recorded lectures on [video.ethz.ch](https://video.ethz.ch/). Other platforms such as Zoom, Moodle, and Polybox are not supported.

### Q: How do I pass a file with links to multiple lectures?

#### A: Use `--file <filename>`
Expand All @@ -67,6 +79,25 @@ Additionally you can also add a username and password at the end of the link sep

**Note:** This is **NOT** recommended for your NETHZ account password for security reasons!

### Q: I don't like having to pass all those parameters each time I download recordings. Is there a better way?

#### A: Yes

You can can create a file called `parameters.txt` in which you put all your parameters. As long as you keep it in the same directory in which you call the scraper, it will automatically detect the file and read the parameters from there.

**Example:**

If you create a file called `parameters.txt` with the following content

```
--all
--quality low
```

and then run `python3 vo-scraper.py <some lecture link>` in that directory it will download all recordings (`--all`) from that lecture in low quality (`--quality low`) without you having to pass any parameters.

If you want to use a different name for the parameter file, you can pass the parameter `--parameter-file <filename>`. Ironically, you cannot do this via `parameters.txt` :P

### <a name="how_it_works"></a> Q: How does it acquire the videos?

#### A: Like so:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
2.0.0
Loading

0 comments on commit 757e77d

Please sign in to comment.