aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2026-03-01 02:10:38 -0600
committericeyrazor <iceyrazor@mailfence.com>2026-03-01 02:10:38 -0600
commit8f4b6174648fb32c8d9013cdedba86bd38c9a0d9 (patch)
tree5ce217890273fac8929ff51f658d2ea84fbd5fc5
parentfedd9c2c81fb0e6e5a0e55bbcd9721829917f070 (diff)
cookies when 3rd arg is t
print insert command for debug
-rw-r--r--.gitignore1
-rwxr-xr-xfetch.sh8
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"