REALLY FUCKING FIXED

This commit is contained in:
coolnsx
2023-04-04 20:13:52 +05:30
parent 67f51554e2
commit f3bf38045c
2 changed files with 7 additions and 6 deletions

View File

@@ -2,9 +2,10 @@
down () { down () {
info_$os "$3 links fetched.." info_$os "$3 links fetched.."
choice=$(printf "stream\ndownload\nnext mirror" | menu_$os "??") choice=$(printf "stream\ndownload\ncast\nnext mirror" | menu_$os "??")
[ -z "$choice" ] && exit 0 [ -z "$choice" ] && exit 0
[ "$choice" = "stream" ] && player_$os "$2" "$title" && info_$os "opening $title" "mpv" && exit 0 [ "$choice" = "stream" ] && player_$os "$2" "$title" && info_$os "opening $title" "mpv" && exit 0
[ "$choice" = "cast" ] && info_$os "casting $title" "podcast" && catt cast "$2" && exit 0
[ "$choice" = "next mirror" ] && return 0 [ "$choice" = "next mirror" ] && return 0
info_$os "Downloading $title" "downloader" info_$os "Downloading $title" "downloader"
case $2 in case $2 in

View File

@@ -54,7 +54,7 @@ help(){
} }
get_data(){ get_data(){
curl -X POST -A "$agent" -s "$base_url/youtubei/v1/$1?key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30&prettyPrint=false" -H "content-type:application/json" -H "x-youtube-client-name:67" -H "x-youtube-client-version:1.20221128.01.00" -d "$2" -b "$cookie" -e "$base_url/$3" curl -X POST -A "$agent" -s "$base_url/youtubei/v1/$1?key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30&prettyPrint=false" -H "content-type:application/json" -H "x-youtube-client-name:67" -H "x-youtube-client-version:1.20221128.01.00" -d "$2" -b "$cookie" -e "$base_url/$3" -c "$cookie"
} }
loop(){ loop(){
@@ -88,12 +88,12 @@ play(){
#get song's audio url #get song's audio url
random_no=$(head /dev/urandom | tr -dc '0-2' | cut -c1) random_no=$(head /dev/urandom | tr -dc '0-2' | cut -c1)
droid_agent="com.google.android.youtube/18.07.34 (Linux; U; Android 1$random_no) gzip" droid_agent="com.google.android.youtube/18.10.36 (Linux; U; Android 1$random_no) gzip"
json="{ json="{
\"context\": { \"context\": {
\"client\": { \"client\": {
\"clientName\": \"ANDROID\", \"clientName\": \"ANDROID\",
\"clientVersion\": \"18.07.34\", \"clientVersion\": \"18.10.36\",
\"androidSdkVersion\": $((random_no + 29)), \"androidSdkVersion\": $((random_no + 29)),
\"userAgent\": \"$droid_agent\", \"userAgent\": \"$droid_agent\",
\"hl\": \"en\", \"hl\": \"en\",
@@ -112,7 +112,7 @@ play(){
\"racyCheckOk\": true \"racyCheckOk\": true
}" }"
audio_url=$(curl -X POST -A "$droid_agent" -s "https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&prettyPrint=false" -H "content-type:application/json" -H "x-youtube-client-name:21" -H "x-youtube-client-version:18.07.34" -d "$json" -b "$cookie" | sed -nE 's_.*itag":251,"url":"([^"]*)".*_\1_p') audio_url=$(curl -X POST -A "$droid_agent" -s "https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&prettyPrint=false" -H "content-type:application/json" -d "$json" -b "$cookie" | sed -nE 's_.*itag":251,"url":"([^"]*)".*_\1_p')
if [ -n "$2" ];then if [ -n "$2" ];then
printf "Name >> %s\n" "$title" printf "Name >> %s\n" "$title"
printf "videoID >> %s\n" "$id" printf "videoID >> %s\n" "$id"
@@ -170,7 +170,7 @@ base_url="https://music.youtube.com"
[ -d "$logdir" ] || mkdir "$logdir" [ -d "$logdir" ] || mkdir "$logdir"
cookie="$logdir/cookies" cookie="$logdir/cookies"
next_data="$logdir/next" next_data="$logdir/next"
agent="Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0" agent="Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/110.0"
#call this script by script-name "function_name" "query" #call this script by script-name "function_name" "query"
[ -z "$1" ] && help "$@" [ -z "$1" ] && help "$@"