... |
... |
@@ -1,14 +1,30 @@
|
1 |
1 |
#! /bin/bash
|
|
2 |
+#This Bash-script should be executed every day (crontab -e)
|
2 |
3 |
|
3 |
|
-#should be executed every day (crontab -e)
|
|
4 |
+#update youtube-dl
|
|
5 |
+youtube-dl -U
|
|
6 |
+sleep 5
|
|
7 |
+
|
|
8 |
+#Date= yesterday
|
4 |
9 |
datum=$(date -d "1 day ago" '+%Y%m%d')
|
5 |
|
-#switch to the default firefox folder with sqlite databases
|
|
10 |
+
|
|
11 |
+# from array. No Firefox needed
|
|
12 |
+#dbarray=(
|
|
13 |
+#"https://www.youtube.com/user/example-foo"
|
|
14 |
+#"https://www.youtube.com/channel/example-bar/videos?sort=dd&shelf_id=0&view=0"
|
|
15 |
+#)
|
|
16 |
+
|
|
17 |
+# from Firefox bookmarks
|
|
18 |
+#switch to the default firefox folder with sqlite databases.
|
|
19 |
+#change *default* if you have other profiles than default.
|
6 |
20 |
cd ~/.mozilla/firefox/*default*
|
7 |
|
-#firefox manages bookmarks in a database. Firefox bookmarks needs a folder auto-yt.
|
8 |
|
-#save playlists in this directory
|
|
21 |
+
|
|
22 |
+#firefox manages bookmarks from database.
|
|
23 |
+#Firefox bookmarks needs a folder auto-yt.
|
|
24 |
+#save all your Youtube playlists in auto-yt
|
9 |
25 |
dbarray=( $(sqlite3 -list places.sqlite 'select url from moz_places where id in (select fk from moz_bookmarks where parent in ( select "id" from moz_bookmarks where title == "auto-yt"))'; ))
|
10 |
|
-#switch home
|
11 |
|
-cd
|
|
26 |
+#switch to your youtube download folder
|
|
27 |
+cd ~/Downloads
|
12 |
28 |
#let youtube-dl do the work and download brandnew videos
|
13 |
29 |
for i in ${dbarray[@]}; do
|
14 |
30 |
youtube-dl --dateafter $datum --playlist-end 4 --max-downloads 2 $i
|