From 1e0be92148bf721bb49b795554b441ba701b2d67 Mon Sep 17 00:00:00 2001 From: coolnsx Date: Sat, 20 Apr 2024 20:48:06 +0530 Subject: [PATCH] Haiyaa --- ani-new | 7 +++---- download | 2 +- revanced | 6 +++--- screen | 6 +++--- torrent | 2 +- yt-music | 39 ++++++++++++++++++++------------------- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ani-new b/ani-new index a42d94e..760476d 100755 --- a/ani-new +++ b/ani-new @@ -1,12 +1,11 @@ #!/bin/sh allanime_curl() { - curl -e "https://allanime.to" -sL AES256-SHA256 -G "https://api.${domain}/api" -A "$agent" --data-urlencode "$1" --data-urlencode "$2" + curl -e "https://allanime.to" -sL -G "https://api.${domain}/api" -A "$agent" --data-urlencode "$1" --data-urlencode "$2" } domain="allanime.day" -random_no=$(head /dev/urandom | tr -dc '7-9' | cut -c1) -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/11${random_no}.0.0.0 Safari/537.36" +agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12$(head /dev/urandom | tr -dc '0-3' | cut -c1).0.0.0 Safari/537.36" debug=$2 case $(uname -o) in @@ -29,7 +28,7 @@ trap "exit 0" INT HUP info_$os "Parsing $domain.. Please wait..." #shellcheck disable=SC2016 -[ -z "$1" ] && url=$(allanime_curl 'query=query($search: SearchInput $limit: Int $page: Int $translationType: VaildTranslationTypeEnumType $countryOrigin: VaildCountryOriginEnumType) { shows( search: $search limit: $limit page: $page translationType: $translationType countryOrigin: $countryOrigin ) {edges { _id name lastEpisodeInfo __typename}}}' 'variables={"search":{"sortBy":"Recent","allowAdult":true,"allowUnknown":true},"limit":40,"page":1,"translationType":"sub","countryOrigin":"JP"}' | sed 's|Show|\n|g' | sed -nE 's|.*_id":"([^"]*)","name":"([^"]*)".*sub":\{"episodeString":"([^"]*)".*|\1\t\2 Episode \3|p' | menu_$os "Select Anime: " '--with-nth 2.. -m' | tr ':' ' ' | tr -s ' ') || url=$(printf "%s" "$1" | sed -nE 's|.*/bangumi/([^/]*)/([^/]*)/p-([^-]*)-sub|\1\t\2 Episode \3|p') +[ -z "$1" ] && url=$(allanime_curl 'query=query($search: SearchInput $limit: Int $page: Int $translationType: VaildTranslationTypeEnumType $countryOrigin: VaildCountryOriginEnumType) { shows( search: $search limit: $limit page: $page translationType: $translationType countryOrigin: $countryOrigin ) {edges { _id name lastEpisodeInfo __typename}}}' 'variables={"search":{"sortBy":"Recent","allowAdult":true,"allowUnknown":true},"limit":40,"page":1,"translationType":"sub","countryOrigin":"JP"}' | sed 's|__typename|\n|g' | sed -nE 's|.*_id":"([^"]*)","name":"([^"]*)".*sub":\{"episodeString":"([^"]*)".*|\1\t\2 Episode \3|p' | menu_$os "Select Anime: " '--with-nth 2.. -m' | tr ':' ' ' | tr -s ' ') || url=$(printf "%s" "$1" | sed -nE 's|.*/bangumi/([^/]*)/([^/]*)/p-([^-]*)-sub|\1\t\2 Episode \3|p') [ -z "$url" ] && error_$os "No anime selected" && exit 0 diff --git a/download b/download index dd8186f..1f39161 100755 --- a/download +++ b/download @@ -64,7 +64,7 @@ instagram() { #main link="$1" -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" +agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12$(head /dev/urandom | tr -dc '0-3' | cut -c1).0.0.0 Safari/537.36" case $(uname -o) in *ndroid*) diff --git a/revanced b/revanced index a13523c..9a4708f 100755 --- a/revanced +++ b/revanced @@ -26,7 +26,7 @@ download_keystore() { } tmp_dir="${TMPDIR:-/tmp}/revanced" -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" +agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" apk_provider_url="https://www.apkmirror.com" date=$(date +%F) rv_cli="cli-$date.jar" @@ -58,7 +58,7 @@ case $app in youtube) arch="universal" [ -z "$2" ] && version=$(curl -s "https://api.revanced.app/v2/patches/latest" | sed -nE 's|.*youtube","versions":\[[0-9\.",]*,"([^\}]*)"\].*|\1|p') || version=$2 - exclude_patch_list="always-autorepeat,disable-auto-captions,disable-zoom-haptics,enable-debugging,external-downloads,hide-autoplay-button,hide-captions-button,hide-cast-button,hide-floating-microphone-button,hide-layout-components,hide-'load-more'-button,hide-player-buttons,custom-player-overlay-opacity,hide-seekbar,hide-timestamp,hide-video-action-buttons,navigation-buttons,player-flyout-menu,remove-player-controls-background,spoof-app-version,swipe-controls" + exclude_patch_list="always-repeat,disable-auto-captions,disable-zoom-haptics,enable-debugging,downloads,hide-autoplay-button,hide-captions-button,hide-cast-button,hide-floating-microphone-button,hide-layout-components,hide-'load-more'-button,hide-player-buttons,custom-player-overlay-opacity,hide-seekbar,hide-timestamp,hide-video-action-buttons,navigation-buttons,player-flyout-menu,remove-player-controls-background,spoof-app-version,swipe-controls" out="yt-revanced-$version.apk" ;; youtube-music) @@ -105,4 +105,4 @@ info "All listed Patches Excluded" info "Patching $app-$version.apk.." #shellcheck disable=SC2086 -java -jar "$tmp_dir/$rv_cli" patch --patch-bundle "$tmp_dir/$rv_patch" --merge "$tmp_dir/$rv_inte" --out "$HOME/$out" $keystore --resource-cache "$tmp_dir/revanced-resource-cache" "$tmp_dir/$app-$version.apk" $exclude_patches +java -jar "$tmp_dir/$rv_cli" patch --patch-bundle "$tmp_dir/$rv_patch" --merge "$tmp_dir/$rv_inte" --out "$HOME/$out" $keystore -t "$tmp_dir/revanced-resource-cache" "$tmp_dir/$app-$version.apk" $exclude_patches diff --git a/screen b/screen index 3e01dc3..44fecd7 100755 --- a/screen +++ b/screen @@ -32,9 +32,9 @@ compress() { record() { rm -f "$tmp_file" "$process_file" #shellcheck disable=SC2034 - mic="$(pactl list sources | grep -B1 'node.nick = "Digital Microphone"' | sed -nE 's|.*node.name = "([^"]*)"|\1.monitor|p')" #It is called in eval on line 9 + mic="alsa_input.pci-0000_04_00.6.analog-stereo" #It is called in eval on line 9 #shellcheck disable=SC2034 - speaker="alsa_output.pci-0000_00_1f.3.analog-stereo.monitor" #It is called in eval on line 9 + speaker="alsa_output.pci-0000_04_00.6.analog-stereo.monitor" #It is called in eval on line 9 source=$(printf "screen only\nspeaker\nmic" | menu "Audio Source:" "3") [ -z "$source" ] && info "" "2000" "No option Selected" && return 0 @@ -114,7 +114,7 @@ stop() { } -tmp_file="/tmp/screenrecord.mp4" +tmp_file="${tmp_file:-/tmp/screenrecord.mp4}" process_file="/tmp/processed.mp4" [ "$#" -gt 0 ] && $1 "$2" diff --git a/torrent b/torrent index 4d474b4..ae62e13 100755 --- a/torrent +++ b/torrent @@ -11,7 +11,7 @@ c_reset="\033[0m" down() { tput reset info_$os "Torrent: Downloading" - aria2c --file-allocation=trunc -d "$download_dir" --select-file="$2" --seed-time=0 --summary-interval=0 "$1" && info_$os "Torrent: Download complete" && return 0 + aria2c --file-allocation=trunc -d "$download_dir" --select-file="$2" --seed-time=0 --seed-ratio='0.0' --summary-interval=0 "$1" && info_$os "Torrent: Download complete" && return 0 error_$os "Torrent: Error!!" } diff --git a/yt-music b/yt-music index 9bfdce3..0d40be2 100755 --- a/yt-music +++ b/yt-music @@ -64,6 +64,13 @@ cleanup_shit() { } get_cookies() { + # the user has firefox installed + if [ ! -f "$HOME/.config/google-chrome/Default/Cookies" ];then + cp "$(find "$HOME/.mozilla" -type f -iname 'cookies.sqlite' | head -1)" "$logdir/cookies.sqlite" + sqlite3 "$logdir/cookies.sqlite" "SELECT name, value FROM moz_cookies WHERE host='.youtube.com' and name NOT like 'ST-%';" | tr '|\n' '=;' > "$cookie" + rm "$logdir/cookies.sqlite" + return 0 + fi for i in $(sqlite3 "$HOME/.config/google-chrome/Default/Cookies" "SELECT name,REPLACE(base64(SUBSTR(encrypted_value,4)),CHAR(10),'') FROM cookies WHERE host_key='.youtube.com';"); do printf "%s=%s; " "$(printf '%s' "$i" | cut -d'|' -f1)" "$(printf '%s' "$i" | cut -d'|' -f2 | base64 -d | openssl enc -d -aes-128-cbc -K fd621fe5a2b402539dfa147ca9272778 -iv 20202020202020202020202020202020)" done >"$cookie" @@ -164,24 +171,18 @@ start_rich_presence() { update_rich_presence() { title=$1 id=$2 - dur=$3 - start=$(date +%s) - payload='{"cmd": "SET_ACTIVITY", "args": {"activity": {"details": "'$(printf "%s" "$title" | sed 's|[^-]*$||;s|-$||;s| $||;s|^ ||')'", "state": "'$(printf "%s" "$title" | sed 's_.* - __;s| $||')'", "timestamps": {"start": '"$start"',"end": '"$((start + dur))"'}, "assets": {"large_image": "https://i.ytimg.com/vi/'$id'/mqdefault.jpg","large_text":"Checkmate Premium Users"},"buttons": [{"label":"Listen Song", "url": "https://music.youtube.com/watch?v='$id'"}]},"pid":786}, "nonce": "1"}' #pid needs to be set and constant so discord knows which application to update - if [ -e "$handshook" ];then - set_activity "$payload" > "$presence" - else - { - #handshake - handshake='{"v":1,"client_id":"'$presence_client_id'"}' - # handshake with opcode - printf "\\000\\000\\000\\000\\$(printf "%03o" "${#handshake}")\\000\\000\\000%s" "$handshake" - - #wait for response which comes within 1 second(max 2 seconds) - sleep 2 - set_activity "$payload" - } > "$presence" + #dur=$3 + #start=$(date +%s) + #payload='{"cmd": "SET_ACTIVITY", "args": {"activity": {"details": "'$(printf "%s" "$title" | sed 's|[^-]*$||;s|-$||;s| $||;s|^ ||')'", "state": "'$(printf "%s" "$title" | sed 's_.* - __;s| $||')'", "timestamps": {"start": '"$start"',"end": '"$((start + dur))"'}, "assets": {"large_image": "https://i.ytimg.com/vi/'$id'/mqdefault.jpg","large_text":"Checkmate Premium Users"},"buttons": [{"label":"Listen Song", "url": "https://music.youtube.com/watch?v='$id'"}]},"pid":786}, "nonce": "1"}' #pid needs to be set and constant so discord knows which application to update + payload='{"cmd": "SET_ACTIVITY", "args": {"activity": {"details": "'$(printf "%s" "$title" | sed 's|[^-]*$||;s|-$||;s| $||;s|^ ||')'", "state": "'$(printf "%s" "$title" | sed 's_.* - __;s| $||')'", "assets": {"large_image": "https://i.ytimg.com/vi/'$id'/mqdefault.jpg","large_text":"Checkmate Premium Users","small_image":"https://upload.wikimedia.org/wikipedia/commons/7/73/Mpv_logo_%28official%29.png"},"buttons": [{"label":"Listen Song", "url": "https://music.youtube.com/watch?v='$id'"}]},"pid":786}, "nonce": "'$(date +%s%N)'"}' #pid needs to be set and constant so discord knows which application to update + if [ ! -e "$handshook" ];then + handshake='{"v":1,"client_id":"'$presence_client_id'"}' + # handshake with opcode + printf "\\000\\000\\000\\000\\$(printf "%03o" "${#handshake}")\\000\\000\\000%s" "$handshake" > "$presence" + sleep 2 touch "$handshook" fi + set_activity "$payload" > "$presence" } play() { @@ -238,7 +239,7 @@ play() { get_song_lyrics "$id" & #start the presence - pgrep -f "nc -U $discord_ipc" > /dev/null || start_rich_presence & + pgrep -f "nc -U $discord_ipc" > /dev/null || setsid -f "$0" start_rich_presence #update the discord rich presence, requires client id update_rich_presence "$title" "$id" "$duration" & @@ -305,7 +306,7 @@ play_next() { menu() { if command -v bemenu >/dev/null; then - bemenu --fn 'IBM Plex Sans 15' -i -c -W 0.5 -B 3 -p "$1" -l 25 -I "${2:-0}" -P ">>" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT" + bemenu --fn 'IBM Plex Sans 15' -i -c -W 0.5 -B 3 -p "$1" -l 26 -I "${2:-0}" -P ">>" --bdr="#$GLOBAL_ACCENT" --tf="#$GLOBAL_ACCENT" --hf="#$GLOBAL_ACCENT" else fzf --prompt="$1" --height=25 --reverse --border=horizontal --header="${2:-0}" --marker=">>" fi @@ -321,7 +322,7 @@ base_url="https://music.youtube.com" [ -d "$logdir" ] || mkdir "$logdir" [ -p "$presence" ] || mkfifo "$presence" cookie="$logdir/cookies" -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36,gzip(gfe)" +agent="Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0" #call this script by script-name "function_name" "query" [ -z "$1" ] && help "$@"