mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
Chuck Norris Emailed Me This Patch... I'm Not Going To Question It
This commit is contained in:
2
revanced
2
revanced
@@ -1,6 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
info() {
|
||||
printf "\033[1;35m=> \033[1;${2:-36}m%s\033[0m\n" "$1"
|
||||
}
|
||||
@@ -73,6 +72,7 @@ case $app in
|
||||
*)
|
||||
info "Wrong Package Name, please pass either 'youtube' or 'youtube-music'" "31"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -f "$tmp_dir/$app-$version.apk" ] && [ ! -f "$tmp_dir/$app-$version.apk.aria2" ]; then
|
||||
|
||||
1
screen
1
screen
@@ -117,5 +117,4 @@ stop() {
|
||||
tmp_file="/tmp/screenrecord.mp4"
|
||||
process_file="/tmp/processed.mp4"
|
||||
|
||||
|
||||
[ "$#" -gt 0 ] && $1 "$2"
|
||||
|
||||
56
yt-music
56
yt-music
@@ -63,8 +63,7 @@ cleanup_shit(){
|
||||
}
|
||||
|
||||
get_cookies() {
|
||||
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
|
||||
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"
|
||||
}
|
||||
@@ -142,43 +141,37 @@ loop() {
|
||||
|
||||
#discord rich presence written in a nut-shell code
|
||||
set_activity() {
|
||||
op=0
|
||||
handshake='{"v":1,"client_id":"'$presence_client_id'"}'
|
||||
datalen=${#handshake}
|
||||
for i in $(seq 0 3); do
|
||||
byte=$(((op >> (i * 8)) & 255))
|
||||
printf "\\$(printf "%03o" "$byte")"
|
||||
done
|
||||
for i in $(seq 0 3); do
|
||||
byte=$(((datalen >> (i * 8)) & 255))
|
||||
printf "\\$(printf "%03o" "$byte")"
|
||||
done
|
||||
printf "%s" "$handshake"
|
||||
op=1
|
||||
datalen=${#1}
|
||||
for i in $(seq 0 3); do
|
||||
byte=$(((op >> (i * 8)) & 255))
|
||||
printf "\\$(printf "%03o" "$byte")"
|
||||
done
|
||||
for i in $(seq 0 3); do
|
||||
byte=$(((datalen >> (i * 8)) & 255))
|
||||
printf "\\$(printf "%03o" "$byte")"
|
||||
#length of payload
|
||||
len=${#1}
|
||||
#outputs opcode in little endian encoding
|
||||
printf "\\001\\000\\000\\000"
|
||||
#loop for length to encode in little endian encoding
|
||||
for i in 0 8 16 24; do
|
||||
len=$((len >> i))
|
||||
#shellcheck disable=SC2059
|
||||
printf "\\$(printf "%03o" "$len")"
|
||||
done
|
||||
#print the payload that need to be sent
|
||||
printf "%s" "$1"
|
||||
}
|
||||
|
||||
update_rich_presence() {
|
||||
pkill -f "nc -U $discord_ipc" >/dev/null
|
||||
sleep 2
|
||||
title=$1
|
||||
id=$2
|
||||
dur=$3
|
||||
start=$(date +%s)
|
||||
dur=$(printf '{ "command": ["get_property", "duration"] }\n' | socat - "$socket" | sed -nE 's|.*data":([^.]*).*|\1|p')
|
||||
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"}}}, "nonce": "1"}'
|
||||
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
|
||||
{
|
||||
#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"
|
||||
|
||||
#with buttons, but this MF is not working --
|
||||
#payload='{"cmd": "SET_ACTIVITY", "args": {"activity": {"details": "'$(printf "%s" "$title" | sed 's|[^-]*$||;s|-$||;s| $||;s|^ ||')'", "state": "'$(printf "%s" "$title" | sed 's_.* - __;s| $||')'", "timestamps": {"start": '"$(date +%s)"'}, "assets": {"large_image": "https://i.ytimg.com/vi/'$id'/mqdefault.jpg","large_text":"Checkmate Premium Users","buttons": [{"label":"Listen Here", "url": "https://www.youtube.com/watch?v='$id'"}]}}}, "nonce": "1"}'
|
||||
set_activity "$payload" | nc -U "$discord_ipc"
|
||||
#wait for response which comes within 1 second(max 2 seconds)
|
||||
sleep 3
|
||||
set_activity "$payload"
|
||||
} | nc -U "$discord_ipc" >"/tmp/ipclog"
|
||||
}
|
||||
|
||||
play() {
|
||||
@@ -228,11 +221,14 @@ play() {
|
||||
printf '{"command":["loadfile","%s","replace"]}\n' "$audio_url" | socat - "$socket"
|
||||
printf "currently playing : %s >%s\n" "$title" "$id" >"$logdir/current"
|
||||
|
||||
#required for discord rich presence to set end timestamp
|
||||
duration=$(printf '%s' "$audio_url" | sed -nE 's|.*&dur=([^\.]*).*|\1|p')
|
||||
|
||||
#self explainatory
|
||||
get_song_lyrics "$id" &
|
||||
|
||||
#update the discord rich presence, requires client id
|
||||
update_rich_presence "$title" "$id" &
|
||||
update_rich_presence "$title" "$id" "$duration" &
|
||||
|
||||
#next songs data
|
||||
[ -n "$3" ] && get_music_list &
|
||||
|
||||
Reference in New Issue
Block a user