33 lines
748 B
Django/Jinja
33 lines
748 B
Django/Jinja
#!/bin/bash
|
|
|
|
# errors like "sign in to confirm your age" makes youtube-dl return non-zero so
|
|
# this does not work
|
|
#set -e
|
|
|
|
LOCKFILE=/tmp/youtube-dl-mirrors.lock
|
|
lockfile -r 0 $LOCKFILE || exit 1
|
|
|
|
{% set UA = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0" %}
|
|
|
|
du -sh {{ archives.youtube.path }}
|
|
|
|
{% for channel in archives.youtube.channels %}
|
|
|
|
(
|
|
echo "{{ channel.name }}"
|
|
mkdir -p {{ archives.youtube.path }}/{{ channel.name }}/
|
|
cd {{ archives.youtube.path }}/{{ channel.name }}/
|
|
youtube-dl --no-warnings --user-agent "{{ UA }}" -i {{ channel.url }} > /dev/null
|
|
|
|
find {{ archives.youtube.path }}/{{ channel.name }} -ctime -1
|
|
|
|
)
|
|
|
|
|
|
{% endfor %}
|
|
|
|
du -sh {{ archives.youtube.path }}
|
|
|
|
|
|
rm -f $LOCKFILE
|