diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rwxr-xr-x | fetch.sh | 8 |
2 files changed, 7 insertions, 2 deletions
@@ -7,3 +7,4 @@ vids/** title_vids/** web/ytlist/sql-wasm.js web/ytlist/sql-wasm.wasm +cookies.txt @@ -10,14 +10,18 @@ cd "$(dirname "$0")" file="./download.txt" +[ "$3" == "t" ] && Cookies="--cookies cookies.txt" + if [ "$1" ]; then [ -z "$2" ] && echo playlist not defined. continue? && read -p "continue? (press any key)" - yt-dlp --get-filename -o "%(title)s----%(id)s----%(channel)s" "$1" > "$file" 2> download_err.txt + yt-dlp $Cookies --get-filename -o "%(title)s----%(id)s----%(channel)s" "$1" > "$file" 2> download_err.txt printf "\n\n" i=1 max=$(( $(wc -l "$file" | sed 's/ .*//g') )) while :; do + printf -- "insert into ytlist values('%s','%s','')" "$(head -n $i $file | tail -n 1 | sed "s/'/''/g" | sed "s/----/','/g" )" "$2" + printf "\n" printf -- "insert into ytlist values('%s','%s','')" "$(head -n $i $file | tail -n 1 | sed "s/'/''/g" | sed "s/----/','/g" )" "$2" | sqlite3 ./youtube_stuffs.db printf "insert: $i\n" ((i=$i+1)) @@ -39,7 +43,7 @@ while :; do urlid="$(sqlite3 ./youtube_stuffs.db 'select id from ytlist where rowid='$i';')" if [ -z "$(ls -l thumbnails | grep ".$urlid")" ]; then printf "$i::$urlid\n" - thumbnailurl="$(yt-dlp --get-thumbnail "https://youtube.com/watch?v=$urlid" 2>> thumberr.txt)" + thumbnailurl="$(yt-dlp $Cookies --get-thumbnail "https://youtube.com/watch?v=$urlid" 2>> thumberr.txt)" if [ ! "$thumbnailurl" == "" ]; then ext="$(printf "$thumbnailurl" | sed 's/.*\.//g' | sed 's/?.*//')" wget "$thumbnailurl" -O "thumbnails/$urlid.$ext" |
