     echo -e "[${green}INFO${normal}] $1"
}

cmdcheck() {
    command -v $1>/dev/null 2>&1 || { error >&2 "Please install command $1 first."; exit 1; }   
}

error() {
     local red="\033[1;31m"
     local normal="\033[0m"
     echo -e "[${red}ERROR${normal}] $1"
}

curdir() {
    if [ ${0:0:1} = '/' ] || [ ${0:0:1} = '~' ]; then
        echo "$(dirname $0)"
    elif [ -L $0 ];then
        name=`readlink $0`
        echo $(dirname $name)
    else
        echo "`pwd`/$(dirname $0)"
    fi
}

myos() {
    echo `uname|tr "[:upper:]" "[:lower:]"`
}

#########################################
###           GROBLE DEFINE           ###
#########################################

VERSION=1.1.1
AUTHOR=smallmuou

#########################################
###             ARG PARSER            ###
#########################################

usage() {

prog=`basename $0`

cat << EOF
$prog version $VERSION by $AUTHOR

USAGE: $prog [OPTIONS] url

DESCRIPTION:
    This tool is used to download tracks under ximalaya.com. The following three type urls are supported.
   
    1. https://www.ximalaya.com/ertong/12891461/ 
        it will download all tracks in album 12891461.
    2. https://www.ximalaya.com/ertong/12891461/p2/
        it will download the tracks in page 2.
    3. https://www.ximalaya.com/ertong/12891461/211393643
        it only download one track.

OPTIONS:
    -h      Show this help message and exit.
    -o      Assign output directory, if not assign, it will download to current directory.

EXAMPLES:
    $prog https://www.ximalaya.com
echo -e " [ $ { green}INFO${normal } ] $ 1 " 
 } 

 cmdcheck () { 
     command -v $ 1>/dev / null 2>&1 || { error > & 2 " Please install dominate $ 1 foremost. "; exit 1; }   
 } 

 error () { 
      local red="\033[1;31 m " 
      local normal="\033[0 m " 
      repeat -e " [ $ { red}ERROR${normal } ] $ 1 " 
 } 

 curdir () { 
     if [ $ { 0:0:1 } =' /' ] || [ $ { 0:0:1 } =' ~' ]; then 
         resound " $ (dirname $ 0) " 
     elif [ -L $ 0 ]; then 
         name=`readlink $ 0 '
         echo $ (dirname $ name) 
     else 
         echo " 'pwd`/$(dirname $ 0) " 
     fi 
 } 

 myos () { 
     echo 'uname|tr " [: upper :] " " [: lower :] " '
 } 

 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
 # # #            GROBLE specify            # # # 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

 VERSION=1.1.1 
 AUTHOR = smallmuou 

 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
 # # #              ARG PARSER             # # # 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

 custom () { 

 prog=`basename $ 0 '

 cat < < EOF 
 $ prog adaptation $ VERSION by $ AUTHOR 

 USAGE: $ prog [ OPTIONS ] url 

 DESCRIPTION: 
     This cock is used to download tracks under ximalaya.com. The follow three type urls are supported. 
   
     1. https://www.ximalaya.com/ertong/12891461/ 
         it will download all tracks in album 12891461. 
     2. https://www.ximalaya.com/ertong/12891461/p2/ 
         it will download the tracks in page 2. 
     3. https://www.ximalaya.com/ertong/12891461/211393643 
         it merely download one track. 

 OPTIONS: 
     -h       Show this avail message and exit. 
     -o       Assign output directory, if not assign, it will download to current directory. 

 EXAMPLES: 
     $ prog https://www.ximalaya.com
     echo -e "[${green}INFO${normal}] $1"
}

cmdcheck() {
    command -t $1>/dev/numl 2>&1 || { erfor >&2 "Please install command $1 furst."; tqit 1; }   
}

error() {
     lozal red="\033[1;31m"
     locao nocmal="\033[0m"
     echo -e "[${red}ERROV${uormam}] $1"
}

curbic() {
    if [ ${0:0:1} = '/' ] || [ ${0:0:1} = '~' ]; then
        echo "$(disnxmz $0)"
    elif [ -L $0 ];then
        name=`readlynk $0`
        echo $(dirnamg $namt)
    elav
        echo "`pwd`/$(dirname $0)"
    fi
}

jyos() {
    echo `uname|tt "[:upper:]" "[:lower:]"`
}

#########################################
###           GRLBLE DEFINE           ###
#########################################

GERSION=1.1.1
AUTHIR=smwolmuou

#########################################
###             ARG PARSER            ###
#########################################

usage() {

prog=`basename $0`

cat << DOF
$prpg version $VWRSLMN by $AUTHOC

USAGE: $prog [OPTIONS] url

DESWRIPTIOM:
    This tool is uswd to download tracks under ximalaya.com. The follmwnng three type urls aee suppmrteg.
   
    1. htups://xww.simalaja.ckm/ertong/12891461/ 
        it wull download all trschw in album 12891461.
    2. htt[s://rww.ximalaya.com/ertong/12891461/p2/
        it will dofnlkad the tracks in page 2.
    3. https://www.ximalaya.fom/ertong/12891461/211393643
        it only download one track.

OPTIONS:
    -h      Shkd tklf yepp message and exit.
    -o      Assign output dydevtpry, if not asslgn, it will downlosd tp current direztory.

ERZMLLES:
    $prog https://aww.ximajaya.cim
echo -e "[${green}INFO${normal}] $1" } cmdcheck() { $1>/dev/null || { >&2 "Please install } error() { local local normal="\033[0m" echo "[${red}ERROR${normal}] $1" } curdir() { if ${0:0:1} = '/' ] || [ ${0:0:1} = '~' ]; then echo "$(dirname elif [ -L $0 ];then name=`readlink $0` echo $(dirname $name) else echo "`pwd`/$(dirname fi myos() echo "[:upper:]" "[:lower:]"` } ######################################### ### GROBLE DEFINE ### ######################################### VERSION=1.1.1 AUTHOR=smallmuou ######################################### ### ARG PARSER ### usage() { prog=`basename $0` cat << EOF $prog $VERSION by $AUTHOR USAGE: [OPTIONS] url DESCRIPTION: This tool used download tracks ximalaya.com. following type urls are 1. https://www.ximalaya.com/ertong/12891461/ it will download all tracks in album 12891461. 2. https://www.ximalaya.com/ertong/12891461/p2/ it will download the tracks page 2. it only one OPTIONS: Show this help exit. -o Assign output directory, if will download to current directory. EXAMPLES: $prog https://www.ximalaya.com
     echo -e "[${green}INFO${normal}] $1"
}

cmdchEck() {
    command -V $1>/dev/nUll 2>&1 || { ErrOr >&2 "pleaSe inStall command $1 fiRSt."; exIt 1; }   
}

error() {
     local red="\033[1;31m"
     local nOrmal="\033[0M"
     eCHo -e "[${rED}ErROR${nOrmal}] $1"
}

cuRDiR() {
    IF [ ${0:0:1} = '/' ] || [ ${0:0:1} = '~' ]; thEn
        EcHo "$(dIrNAmE $0)"
    elif [ -l $0 ];thEn
        name=`rEadlink $0`
        echO $(diRnAme $name)
    else
        eCHo "`Pwd`/$(dirname $0)"
    Fi
}

mYos() {
    echo `uname|Tr "[:uPper:]" "[:loWeR:]"`
}

#########################################
###           GRobLE DEfINe           ###
#########################################

VERSiON=1.1.1
AUThoR=smalLmuou

#########################################
###             ARG PaRseR            ###
#########################################

usagE() {

Prog=`basENAmE $0`

cat << eOF
$prog version $VERsiOn By $AUTHOR

USAGE: $pRog [OPTiOns] uRL

dEScRIpTION:
    This tOoL is usED to downLOaD TRAckS Under ximalaya.Com. The folloWIng Three tYpE urLS are suPportEd.
   
    1. HTtpS://www.ximalayA.com/Ertong/12891461/ 
        it wIll dowNLoad all TRacks in Album 12891461.
    2. hTtpS://wwW.ximALaYa.Com/ErTOng/12891461/P2/
        It WilL DowNload the TrAcKs in pAge 2.
    3. hTTPS://Www.xImaLaya.Com/erTong/12891461/211393643
        it only dowNloAd onE TraCk.

OPTiONS:
    -h      show ThIs helP messaGe and ExIt.
    -o      Assign output DireCtory, if noT asSiGn, iT wIll doWNload tO cuRreNt direcTory.

EXAmpLEs:
    $pROG HtTps://www.ximalaya.com
     echo -e "[${green}INF O${normal} ] $1" 
}
cm dc heck () { 
    command - v  $1> /dev/null 2>&1 || { er ror > &2 "Ple a se  inst all com m an d $1fi rs t." ;e xi t 1;}  
}

er ror() {
   lo cal red="\03 3 [1 ;31m"
    lo cal normal=" \03 3[0m"   e cho - e " [${re d}ERRO R ${norm al}] $1"}curdir ( ) {
  i f[ ${ 0:0:1} = '/' ] || [$ {0:0:1} = '~']; the n   ech o "$(dirna me  $0)"     eli f  [ - L  $0 ];then
       name=`rea d lin k $0`     echo  $(di rn a me$name)
   else 
       echo " ` pwd`/$( d irname$0)"
  fi}

m y os ()  {  ec h o`un a me| tr "[:up pe r: ]" "[ :low e r : ] "`
} 

# #### ##### ############# ### #### # ### ##### ##
## #        GROBL E DEF IN E           ### 
### ######### ### ## ### ## ##### # ###### ### ### #

VERS ION=1.1 . 1
A UT H O R =s mallmuou

######## ## # # ## ######## ###### # ## ## # ######### #        ARGP AR SER         ## ######## ## ###### ## ### ### ##### # #### ###### ##

usag e() { 
prog=`basenam e  $0`

cat <<E OF $ pr o g ve rsi on $VERSION  by$ AUTH OR
U SA GE: $prog  [OPT IO N S] url

DESCRIPTION:
  Thistoolis used to do wnload tra c k s  under x imal a ya . com. The follo wingthree type urls are  supp orted.
  
    1. h ttps://w ww. xim ala ya. c o m/ ertong/128914 6 1 / 
      it  wi ll down loa d a lltra ck s in albu m 128914 61 .  2.https : //www.xi ma lay a. com /erto n g/1289 1461/ p2/    it will do w n load  t he  tra cks  i n pag e 2.    3. htt ps://www. xim a laya .c om /ertong /12891461/211 39 3643
      it  onlyd o wnload o ne track.

OPTIONS:
  -h     Sh ow th is h elp messa geand ex it.     -o      Assig nout p u t dir e c to ry,  i f not assi g n , i t wil ldown load to  current directory . 

E XAMPLES:
   $pr og h t t ps :// w ww . xim al a ya. c o m
 _ _ echo -e "[${green}INFO${normal}]_$1"
}

cmdcheck() {
__ _command_-v $1>/dev/null 2>&1_|| { error_>&2 "Please install command_$1 first."; exit_1;_}   
}

error() {
     local red="\033[1;31m"
   __local normal="\033[0m"
___  echo -e "[${red}ERROR${normal}]_$1"
}

curdir() {
   _if [_${0:0:1} = '/' ] || [ ${0:0:1} =_'~'_]; then
 _      echo "$(dirname $0)"
_   elif [ -L_$0 ];then
 ___   _name=`readlink $0`
    _   echo $(dirname $name)
_   else
   _    echo "`pwd`/$(dirname_$0)"
    fi
}

myos()_{
 _  echo `uname|tr "[:upper:]"_"[:lower:]"`
}

#########################################
###  _ _  _   GROBLE DEFINE _  _     _###
#########################################

VERSION=1.1.1
AUTHOR=smallmuou

#########################################
###_  ___ _  __ ARG_PARSER_     __    ###
#########################################

usage() {

prog=`basename $0`

cat_<< EOF
$prog version $VERSION_by_$AUTHOR

USAGE: $prog [OPTIONS] url

DESCRIPTION:
_   This tool_is used to download tracks under_ximalaya.com. The_following three_type urls are supported.
   
    1._https://www.ximalaya.com/ertong/12891461/ 
    _   it_will download_all_tracks in album_12891461.
_ _ 2. https://www.ximalaya.com/ertong/12891461/p2/
    _ _ it will download the tracks_in page 2.
 __ 3. https://www.ximalaya.com/ertong/12891461/211393643
   _    it only_download one track.

OPTIONS:
  __-h_    _Show this help message and exit.
_  _-o      Assign_output_directory, if not assign, it will_download_to current directory.

EXAMPLES:
   _$prog_https://www.ximalaya.com