Browse code

Create youtube-dl.sh

Stefan Höhn authored on25/12/2016 23:48:01 • GitHub committed on25/12/2016 23:48:01
Showing1 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1,15 @@
1
+#! /bin/bash
2
+
3
+#should be executed every day (crontab -e) 
4
+datum=$(date -d "1 day ago" '+%Y%m%d')
5
+#switch to the default firefox dir with sqlite databases
6
+cd ~/.mozilla/firefox/*default*
7
+# firefox manage bookmarks in a database. Firefox  bookmarks needs a directory auto-yt.
8
+#save  playlists in this directory
9
+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
12
+#let youtube-dl do the work  and download brandnew videos
13
+for i in ${dbarray[@]}; do
14
+youtube-dl --dateafter $datum --playlist-end 4 --max-downloads 2 $i
15
+done