From 3742ad8841895949b8318e6710a6d0339ea56ff4 Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 10 Dec 2022 21:55:19 +0100 Subject: [PATCH] getting browser cookies & talking --- ASTROBOT/G1CopierYoutube.sh | 3 ++- ajouter_media.sh | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ASTROBOT/G1CopierYoutube.sh b/ASTROBOT/G1CopierYoutube.sh index 900c9893..35d68421 100755 --- a/ASTROBOT/G1CopierYoutube.sh +++ b/ASTROBOT/G1CopierYoutube.sh @@ -108,7 +108,7 @@ if [[ ! ${TIDDLER} ]]; then [[ ! $TITLE ]] && echo "NO TITLE" && continue echo ".... Downloading $TITLE.mp4" - + espeak "$TITLE" > /dev/null 1>&2 # https://github.com/yt-dlp/yt-dlp#format-selection-examples # SUBS ? --write-subs --write-auto-subs --sub-langs "fr, en, en-orig" --embed-subs # (bv*[height<=720][vcodec~='^((he|a)vc|h26[45])']+ba) @@ -141,6 +141,7 @@ if [[ ! ${TIDDLER} ]]; then ## LIMIT TO 12 MAXIMUM COPY PER DAY PER PLAYER boucle=$((boucle+1)) + espeak "$bouche video" > /dev/null 1>&2 [[ $boucle == 13 ]] && echo "MAXIMUM COPY REACHED" && break #################################################### diff --git a/ajouter_media.sh b/ajouter_media.sh index 622e4a67..5baef9ec 100755 --- a/ajouter_media.sh +++ b/ajouter_media.sh @@ -58,6 +58,8 @@ MOATS=$(date -u +"%Y%m%d%H%M%S%4N") IPFSNODEID=$(cat ~/.ipfs/config | jq -r .Identity.PeerID) [[ $IPFSNODEID == "" ]] && echo "IPFSNODEID manquant" && espeak "IPFS NODE ID Missing" && exit 1 +BROWSER=$(xdg-settings get default-web-browser | cut -d '.' -f 1 | cut -d '-' -f 1) ## GET cookies-from-browser + myIP=$(hostname -I | awk '{print $1}' | head -n 1) isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/") [[ ! $myIP || $isLAN ]] && myIP="ipfs.localhost" @@ -486,6 +488,7 @@ then # Download mp3 from 1st youtube search video result (--write-info-json) /usr/local/bin/youtube-dl --default-search ytsearch1: \ + --cookies-from-browser $BROWSER \ --ignore-errors --no-mtime \ --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata \ --extract-audio --audio-format mp3 -o "${YTEMP}/%(id)s&%(title)s.%(ext)s" "$artist $song"