From 8f4b6174648fb32c8d9013cdedba86bd38c9a0d9 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Sun, 1 Mar 2026 02:10:38 -0600 Subject: cookies when 3rd arg is t print insert command for debug --- .gitignore | 1 + fetch.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1201210..a046792 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ vids/** title_vids/** web/ytlist/sql-wasm.js web/ytlist/sql-wasm.wasm +cookies.txt diff --git a/fetch.sh b/fetch.sh index 3f9c6db..d7a7e61 100755 --- a/fetch.sh +++ b/fetch.sh @@ -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" -- cgit v1.3