2015-07-12 18:43:50 +02:00
|
|
|
youtube-worker
|
|
|
|
==============
|
|
|
|
|
2015-07-13 07:51:49 +02:00
|
|
|
`youtube-worker` = `youtube-dl` + `redis`
|
2015-07-12 18:43:50 +02:00
|
|
|
|
|
|
|
## docker-compose.yml
|
|
|
|
|
|
|
|
```
|
|
|
|
worker:
|
|
|
|
image: vimagick/youtube-worker
|
|
|
|
links:
|
|
|
|
- redis
|
|
|
|
volumes:
|
|
|
|
- data:/data
|
|
|
|
environment:
|
2015-07-13 07:51:49 +02:00
|
|
|
- DATABASE=1
|
2015-07-12 18:43:50 +02:00
|
|
|
- PASSWORD=secret-passwd
|
2015-07-13 04:31:43 +02:00
|
|
|
- FORMAT=worst
|
|
|
|
- OUTTMPL=%(id)s.%(ext)s
|
2015-07-12 18:43:50 +02:00
|
|
|
restart: always
|
|
|
|
|
|
|
|
redis:
|
|
|
|
image: redis
|
|
|
|
command: redis-server --requirepass 'secret-passwd'
|
|
|
|
ports:
|
|
|
|
- "6379:6379"
|
|
|
|
restart: always
|
|
|
|
```
|
|
|
|
|
2015-07-13 05:00:36 +02:00
|
|
|
> [format-selection](https://github.com/rg3/youtube-dl#format-selection).
|
|
|
|
|
2015-07-12 18:43:50 +02:00
|
|
|
## server
|
|
|
|
|
|
|
|
```
|
|
|
|
$ cd ~/fig/youtube/
|
|
|
|
|
|
|
|
$ docker-compose up -d
|
|
|
|
|
|
|
|
$ docker-compose logs
|
|
|
|
Attaching to youtube_worker_1
|
2015-07-12 19:58:37 +02:00
|
|
|
worker_1 | 2015-07-12T17:50:02 [INFO] connect redis
|
|
|
|
worker_1 | 2015-07-12T17:50:06 [INFO] process: os6U77Hhm_s
|
2015-07-12 18:43:50 +02:00
|
|
|
worker_1 | [youtube] os6U77Hhm_s: Downloading webpage
|
|
|
|
worker_1 | [youtube] os6U77Hhm_s: Downloading video info webpage
|
|
|
|
worker_1 | [youtube] os6U77Hhm_s: Extracting video information
|
|
|
|
worker_1 | [youtube] os6U77Hhm_s: Downloading DASH manifest
|
|
|
|
worker_1 | [youtube] os6U77Hhm_s: Downloading DASH manifest
|
2015-07-13 07:51:49 +02:00
|
|
|
worker_1 | [info] Writing video description metadata as JSON to: os6U77Hhm_s.info.json
|
|
|
|
worker_1 | [download] Destination: os6U77Hhm_s.mp4
|
2015-07-12 19:58:37 +02:00
|
|
|
[download] 100% of 11.03MiB in 00:0014MiB/s ETA 00:001nown ETA
|
|
|
|
worker_1 | 2015-07-12T17:50:07 [INFO] success: True
|
2015-07-12 18:43:50 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## client
|
|
|
|
|
|
|
|
```
|
2015-07-13 07:51:49 +02:00
|
|
|
$ redis-cli -h server -n 1 -a 'secret-passwd'
|
|
|
|
server[1]> lpush pending os6U77Hhm_s
|
|
|
|
server[1]> keys *
|
2015-07-12 19:46:37 +02:00
|
|
|
1) "pending"
|
2015-07-13 07:51:49 +02:00
|
|
|
server[1]> keys *
|
2015-07-12 19:46:37 +02:00
|
|
|
1) "running"
|
2015-07-13 07:51:49 +02:00
|
|
|
server[1]> keys *
|
2015-07-12 19:46:37 +02:00
|
|
|
1) "finished"
|
2015-07-13 07:51:49 +02:00
|
|
|
server[1]> quit
|
2015-07-12 18:43:50 +02:00
|
|
|
|
2015-07-12 19:46:37 +02:00
|
|
|
$ rsync -ahP user@server:fig/youtube/data
|
|
|
|
receiving file list ...
|
|
|
|
2 files to consider
|
2015-07-12 19:58:37 +02:00
|
|
|
drwxr-xr-x 74 2015/07/13 01:50:07 data
|
2015-07-13 07:51:49 +02:00
|
|
|
-rw-r--r-- 19722 2015/06/15 17:19:16 data/os6U77Hhm_s.info.json
|
|
|
|
-rw-r--r-- 11569834 2015/06/15 17:19:16 data/os6U77Hhm_s.mp4
|
2015-07-12 19:46:37 +02:00
|
|
|
|
|
|
|
sent 16 bytes received 116 bytes 29.33 bytes/sec
|
2015-07-13 07:51:49 +02:00
|
|
|
total size is 11.78M speedup is 87650.26
|
2015-07-12 18:43:50 +02:00
|
|
|
```
|