From 197746a5e4c961240c54743db8c277d40d2731b0 Mon Sep 17 00:00:00 2001 From: coolnsx Date: Fri, 5 Jun 2026 21:03:07 +0530 Subject: [PATCH] should get thru ci now --- .functions | 47 ++++++++++++++++++++++++++++------------------- ani-new | 24 ++++++++++++------------ screen | 5 ++++- torrent | 4 +--- yt-music | 20 ++++++++++---------- 5 files changed, 55 insertions(+), 45 deletions(-) diff --git a/.functions b/.functions index 2b5968f..c0b8a72 100644 --- a/.functions +++ b/.functions @@ -11,7 +11,7 @@ menu_linux() { } search_droid() { - printf "%s" "$1" && read -r query + printf "\n\033[1;33m%s\033[0m" "$1" && read -r query } search_linux() { @@ -28,7 +28,7 @@ torrent_droid() { } info_droid() { - printf "\n\r\033[1;36m%s" "$1" + printf "\n\r\033[1;36m%s\033[0m" "$1" } info_linux() { @@ -36,7 +36,7 @@ info_linux() { } error_droid() { - printf "\33[2K\r\033[1;31m%s" "$1" + printf "\33[2K\r\033[1;31m%s\033[0m" "$1" } error_linux() { @@ -44,24 +44,33 @@ error_linux() { } player_droid() { - dir="/sdcard/mpv" - file="$dir/mpv.config.mp4" - if [ -w "${dir%*/mpv}" ]; then - [ -d "${dir}" ] || mkdir "${dir}" - printf "%s" "$3" | sed 's| --|\n|g; s|^--||g' > "$file" - sleep 10 && : > "$file" & - else - printf "\n\033[1;31mCannot write\033[0m → $file\n" - printf "\033[1;36mRun:\033[0m termux-setup-storage\n\n" - printf "\033[1;36mThen:\033[0m\n" - printf "> allow storage permission\n" - printf "> add → include='$file'\n" - printf " to MPV → Settings > Advanced > mpv.conf\n" - fi - am start --user 0 -a android.intent.action.VIEW -d "$1" -n is.xyz.mpv/.MPVActivity -e "title" "$2" >/dev/null 2>&1 + url=$1 + title=$2 + shift 2 + + dir="/sdcard/mpv" + file="$dir/mpv.config.mp4" + if [ -w "${dir%*/.mpv}" ]; then + [ -d "${dir}" ] || mkdir "${dir}" + printf "%s" "$@" | sed 's| --|\n|g; s|^--||g' > "$file" + sleep 10 && : > "$file" & + else + printf "\n\033[1;31mCannot write\033[0m → %s\n" "$file" + printf "\033[1;36mRun:\033[0m termux-setup-storage\n\n" + printf "\033[1;36mThen:\033[0m\n" + printf "> allow storage permission\n" + printf "> add → include='%s'\n" "$file" + printf " to MPV → Settings > Advanced > mpv.conf\n" + printf " Make sure to press enter after pasting the content above for MPV to recognise it.." + fi + am start --user 0 -a android.intent.action.VIEW -d "$url" -n is.xyz.mpv/.MPVActivity -e "title" "$title" >/dev/null 2>&1 #am start --user 0 -a android.intent.action.VIEW -d "$1" -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -e "title" "$2" >/dev/null 2>&1 } player_linux() { - setsid -f mpv "$1" --force-media-title="$2" $3 + url=$1 + title=$2 + shift 2 + + setsid -f mpv "$url" --force-media-title="$title" $@ } diff --git a/ani-new b/ani-new index f6d37d3..3e4ed99 100755 --- a/ani-new +++ b/ani-new @@ -2,14 +2,14 @@ # shellcheck disable=SC1091,SC1090 process_response() { - enc_data_base64=$(printf "%s" "$1" | sed -nE 's|.*"tobeparsed":"([^"]*)".*|\1|p') - iv="$(printf '%s' "$enc_data_base64" | base64 -d | dd bs=1 skip=1 count=12 2>/dev/null | od -An -tx1 | tr -d ' \n')00000002" - [ "${#iv}" != 32 ] && error_$os "IV not present in response, maybe the episode not released..?" && exit 0 - data="$(printf '%s' "$enc_data_base64" | base64 -d | dd bs=1 skip=13 2>/dev/null | openssl enc -d -aes-256-ctr -K "a254aa27c410f297bd04ba33a0c0df7ff4e706bf3ae27271c6703f84e750f552" -iv "$iv" -nosalt -nopad 2>/dev/null | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*"sourceUrl":"([^"]*)".*"sourceName":"([^"]*)".*|\2 :\1|p')" + enc_data_base64=$(printf "%s" "$1" | sed -nE 's|.*"tobeparsed":"([^"]*)".*|\1|p') + iv="$(printf '%s' "$enc_data_base64" | base64 -d | dd bs=1 skip=1 count=12 2>/dev/null | od -An -tx1 | tr -d ' \n')00000002" + [ "${#iv}" != 32 ] && error_$os "IV not present in response, maybe the episode not released..?" && exit 0 + data="$(printf '%s' "$enc_data_base64" | base64 -d | dd bs=1 skip=13 2>/dev/null | openssl enc -d -aes-256-ctr -K "a254aa27c410f297bd04ba33a0c0df7ff4e706bf3ae27271c6703f84e750f552" -iv "$iv" -nosalt -nopad 2>/dev/null | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*"sourceUrl":"([^"]*)".*"sourceName":"([^"]*)".*|\2 :\1|p')" } hex_decrypt() { - printf '%s' "$1" | sed 's/../&\n/g' | sed 's/^--$/\n/g;s/^79$/A/g;s/^7a$/B/g;s/^7b$/C/g;s/^7c$/D/g;s/^7d$/E/g;s/^7e$/F/g;s/^7f$/G/g;s/^70$/H/g;s/^71$/I/g;s/^72$/J/g;s/^73$/K/g;s/^74$/L/g;s/^75$/M/g;s/^76$/N/g;s/^77$/O/g;s/^68$/P/g;s/^69$/Q/g;s/^6a$/R/g;s/^6b$/S/g;s/^6c$/T/g;s/^6d$/U/g;s/^6e$/V/g;s/^6f$/W/g;s/^60$/X/g;s/^61$/Y/g;s/^62$/Z/g;s/^59$/a/g;s/^5a$/b/g;s/^5b$/c/g;s/^5c$/d/g;s/^5d$/e/g;s/^5e$/f/g;s/^5f$/g/g;s/^50$/h/g;s/^51$/i/g;s/^52$/j/g;s/^53$/k/g;s/^54$/l/g;s/^55$/m/g;s/^56$/n/g;s/^57$/o/g;s/^48$/p/g;s/^49$/q/g;s/^4a$/r/g;s/^4b$/s/g;s/^4c$/t/g;s/^4d$/u/g;s/^4e$/v/g;s/^4f$/w/g;s/^40$/x/g;s/^41$/y/g;s/^42$/z/g;s/^08$/0/g;s/^09$/1/g;s/^0a$/2/g;s/^0b$/3/g;s/^0c$/4/g;s/^0d$/5/g;s/^0e$/6/g;s/^0f$/7/g;s/^00$/8/g;s/^01$/9/g;s/^15$/-/g;s/^16$/./g;s/^67$/_/g;s/^46$/~/g;s/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1e$/&/g;s/^10$/\(/g;s/^11$/\)/g;s/^12$/*/g;s/^13$/+/g;s/^14$/,/g;s/^03$/;/g;s/^05$/=/g;s/^1d$/%/g;' | tr -d '\n' } domain="allanime.day" @@ -66,19 +66,19 @@ printf "%s\n" "$url" | while read -r id title; do printf 'sharepoint\tS-mp4\nYoutube\tYt-mp4\nmp4upload\tMp4\n' | while read -r provider_name provider_regex; do info_$os "Fetching $provider_name links" - provider_id="$(printf "%s" "$data" | sed -n "/$provider_regex :/p" | cut -d':' -f2-)" - [ -z "$provider_id" ] && continue + provider_id="$(printf "%s" "$data" | sed -n "/$provider_regex :/p" | cut -d':' -f2-)" + [ -z "$provider_id" ] && continue case $provider_name in mp4upload) - provider_video=$(curl -sLk "$provider_id" -A "$agent" -e "$refer" | sed -nE 's|.*src: "([^"]*)"[[:space:]]*|\1|p') + provider_video=$(curl -sLk "$provider_id" -A "$agent" -e "$refer" | sed -nE 's|.*src: "([^"]*)"[[:space:]]*|\1|p') refer="$provider_id" ;; Youtube) - provider_video=$(hex_decrypt "$provider_id") - ;; + provider_video=$(hex_decrypt "$provider_id") + ;; *) - provider_id="$(hex_decrypt "$provider_id" | sed "s/\/clock/\/clock\.json/")" + provider_id="$(hex_decrypt "$provider_id" | sed "s/\/clock/\/clock\.json/")" provider_video=$(curl -e "$refer" -A "$agent" -s "https://${domain}${provider_id}" | sed 's|},{|\n|g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\1|p;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p' | head -1) ;; esac @@ -92,7 +92,7 @@ printf "%s\n" "$url" | while read -r id title; do stream) info_$os "opening $title" "mpv" # shellcheck disable=SC2086 - player_$os "$provider_video" "$title" "--referrer='$refer' --tls-verify=no" + player_$os "$provider_video" "$title" --referrer="$refer" --tls-verify=no --user-agent="$agent" break ;; cast) diff --git a/screen b/screen index 43223ec..3209fda 100755 --- a/screen +++ b/screen @@ -87,7 +87,10 @@ stop() { defaultname="screenrecord-$(date +"%F_%H-%M-%S").mp4" filename=$(: | menu "Enter Filename (default: $defaultname):") [ -z "$filename" ] && filename=$defaultname - mv "$tmp_file" "$HOME/$filename" + directory="${XDG_VIDEO_DIR:-$HOME/videos}" + [ -d "$directory" ] || mkdir -p "$directory" + mv "$tmp_file" "$directory/$filename" + info "kfloppy" "2000" "Saved as $directory/$filename" ;; *) diff --git a/torrent b/torrent index 8d29be2..9a16e51 100755 --- a/torrent +++ b/torrent @@ -18,12 +18,10 @@ down() { magnet="$1" if [ "$(uname -o)" = "Android" ]; then os="droid" - script_dir="$HOME/.shortcuts" download_dir="/sdcard" [ -z "$magnet" ] && magnet="$(termux-clipboard-get)" else os="linux" - script_dir="$HOME/repos_scripts" download_dir="$HOME/Softwares" [ -z "$magnet" ] && magnet="$(wl-paste)" terminal="${TERMINAL:-foot}" @@ -36,7 +34,7 @@ fi #import generic functions # shellcheck source=./.functions -. "$script_dir/.functions" +. "$(dirname "$0")"/.functions filepath="$HOME/.cache" #check if the url is magnet diff --git a/yt-music b/yt-music index 59bd365..e66f3dd 100755 --- a/yt-music +++ b/yt-music @@ -116,7 +116,7 @@ get_song_lyrics() { \"client\": { \"clientName\": \"ANDROID_MUSIC\", \"clientVersion\": \"$yt_music_ver\", - \"androidSdkVersion\": $((random_no + extra_up + 29)), + \"androidSdkVersion\": $((random_no + 30)), \"userAgent\": \"$yt_music_agent\", \"hl\": \"en\", \"timeZone\": \"UTC\", @@ -164,7 +164,7 @@ play() { \"client\": { \"clientName\": \"ANDROID\", \"clientVersion\": \"$yt_ver\", - \"androidSdkVersion\": $((random_no + extra_up + 29)), + \"androidSdkVersion\": $((random_no + 30)), \"userAgent\": \"$yt_agent\", \"hl\": \"en\", \"timeZone\": \"UTC\", @@ -212,7 +212,7 @@ search_play() { [ -z "$query" ] && notify-send -e "Err.. Search query empty" -u critical -h "string:x-canonical-private-synchronous:${0##*/}" && exit 1 #storing context - printf '{"client":{"clientName":"WEB_REMIX","clientVersion":"1.20250616.03.00"}}' >"$logdir/context" + printf '%s' "$web_context" >"$logdir/context" #extracting your cookies so that the song list are according to your taste get_cookies @@ -277,19 +277,19 @@ base_url="https://music.youtube.com" cookie="$logdir/cookies" # user agents, used by script -random_no=$(head /dev/urandom | tr -dc '4-7' | cut -c1) +random_no=$(head /dev/urandom | tr -dc '4-8' | cut -c1) # web -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/13$random_no.0.0.0 Safari/537.36" +agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/14$random_no.0.0.0 Safari/537.36" # random number for android -random_no=$(head /dev/urandom | tr -dc '1-5' | cut -c1) -# android -extra_up=$((random_no > 1)) +random_no=$(head /dev/urandom | tr -dc '2-6' | cut -c1) # youtube -yt_ver="20.23.40" +yt_ver="21.22.165" yt_agent="com.google.android.youtube/$yt_ver (Linux; U; Android 1$random_no) gzip" # youtube music -yt_music_ver="8.23.51" +yt_music_ver="9.21.51" yt_music_agent="com.google.android.apps.youtube.music/$yt_music_ver (Linux; U; Android 1$random_no) gzip" +# web context +web_context='{"client":{"clientName":"WEB_REMIX","clientVersion":"1.20260531.05.00"}}' #call this script by script-name "function_name" "query" [ -z "$1" ] && help "$@"