(CommandList
  children: [
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: (BoolUnary op_id:BoolUnary_d child:{($ VSub_Name '$HOME') (/.cache/ytview)})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (Sentence
              child: (C {(rm)} {(-rf)} {($ VSub_Name '$HOME') (/.cache/ytview/)})
              terminator: <Op_Semi ';'>
            )
          ]
          spids: [-1 21]
        )
      ]
      spids: [-1 31]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:player) op:Equal rhs:{(DQ )} spids:[34])]
      spids: [34]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:configuredClient) op:Equal rhs:{(DQ )} spids:[38])]
      spids: [38]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:currentVersion) op:Equal rhs:{(DQ (1.11.1))} spids:[42])]
      spids: [42]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:flag) op:Equal rhs:{(DQ )} spids:[47])]
      spids: [47]
    )
    (FuncDef
      name: getConfiguredClient
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: (C {(command)} {(-v)} {(curl)})
                      terminator: <Op_Amp '&'>
                    )
                    (Sentence
                      child: 
                        (SimpleCommand
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(/dev/null)}
                              spids: [71]
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:configuredClient)
                          op: Equal
                          rhs: {(DQ (curl))}
                          spids: [79]
                        )
                      ]
                      spids: [79]
                    )
                  ]
                  spids: [-1 76]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: (C {(command)} {(-v)} {(wget)})
                      terminator: <Op_Amp '&'>
                    )
                    (Sentence
                      child: 
                        (SimpleCommand
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(/dev/null)}
                              spids: [94]
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:configuredClient)
                          op: Equal
                          rhs: {(DQ (wget))}
                          spids: [102]
                        )
                      ]
                      spids: [102]
                    )
                  ]
                  spids: [85 99]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: (C {(command)} {(-v)} {(fetch)})
                      terminator: <Op_Amp '&'>
                    )
                    (Sentence
                      child: 
                        (SimpleCommand
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(/dev/null)}
                              spids: [117]
                            )
                          ]
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:configuredClient)
                          op: Equal
                          rhs: {(DQ (fetch))}
                          spids: [125]
                        )
                      ]
                      spids: [125]
                    )
                  ]
                  spids: [108 122]
                )
              ]
              else_action: [
                (SimpleCommand
                  words: [
                    {(echo)}
                    {(DQ ('Error: This tool reqires either curl, wget, or fetch to be installed.'))}
                  ]
                  redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[140])]
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              spids: [131 149]
            )
          ]
          spids: [59]
        )
      spids: [55 58]
    )
    (FuncDef
      name: checkInternet
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(echo)} {(-e)} 
                  {
                    (DQ ('GET http://google.com HTTP/1.0') 
                      (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>) (EscapedLiteralPart token:<Lit_EscapedChar '\\n'>)
                    )
                  }
                )
                (SimpleCommand
                  words: [{(nc)} {(google.com)} {(80)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {(/dev/null)}
                      spids: [179]
                    )
                    (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[183])
                  ]
                )
              ]
              negated: False
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {($ VSub_QMark '$?')} {(-eq)} {(0)} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})]
                  spids: [-1 203]
                )
              ]
              else_action: [
                (SimpleCommand
                  words: [{(echo)} {(DQ ('Error: no active internet connection'))}]
                  redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[223])]
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              spids: [214 235]
            )
          ]
          spids: [158]
        )
      spids: [154 157]
    )
    (FuncDef
      name: httpGet
      body: 
        (BraceGroup
          children: [
            (Case
              to_match: {(DQ ($ VSub_Name '$configuredClient'))}
              arms: [
                (case_arm
                  pat_list: [{(curl)}]
                  action: [(C {(curl)} {(-A)} {(curl)} {(-s)} {(DQ ($ VSub_At '$@'))})]
                  spids: [259 260 273 -1]
                )
                (case_arm
                  pat_list: [{(wget)}]
                  action: [(C {(wget)} {(-qO-)} {(DQ ($ VSub_At '$@'))})]
                  spids: [276 277 286 -1]
                )
                (case_arm
                  pat_list: [{(fetch)}]
                  action: [(C {(fetch)} {(-o)} {(DQ (...))})]
                  spids: [289 290 299 -1]
                )
              ]
              spids: [250 256 302]
            )
          ]
          spids: [247]
        )
      spids: [243 246]
    )
    (FuncDef
      name: update
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:repositoryName)
                  op: Equal
                  rhs: {(DQ (Bash-Snippets))}
                  spids: [326]
                )
              ]
              spids: [326]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:githubUserName)
                  op: Equal
                  rhs: {(DQ (alexanderepstein))}
                  spids: [335]
                )
              ]
              spids: [335]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:nameOfInstallFile)
                  op: Equal
                  rhs: {(DQ (install.sh))}
                  spids: [344]
                )
              ]
              spids: [344]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:latestVersion)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(httpGet)} 
                                    {(https) (Lit_Other ':') (//api.github.com/repos/) 
                                      ($ VSub_Name '$githubUserName') (/) ($ VSub_Name '$repositoryName') (/tags)
                                    }
                                  )
                                  (C {(grep)} {(-Eo)} {(SQ <'"name":.*?[^\\\\]",'>)})
                                  (C {(head)} {(-1)})
                                  (C {(grep)} {(-Eo)} {(DQ ('[0-9.]+'))})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [354 390]
                      )
                    }
                  spids: [353]
                )
              ]
              spids: [353]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (LogicalOr
                              left: 
                                (BoolBinary
                                  op_id: BoolBinary_GlobDEqual
                                  left: {($ VSub_Name '$currentVersion')}
                                  right: {(DQ )}
                                )
                              right: 
                                (LogicalOr
                                  left: 
                                    (BoolBinary
                                      op_id: BoolBinary_GlobDEqual
                                      left: {($ VSub_Name '$repositoryName')}
                                      right: {(DQ )}
                                    )
                                  right: 
                                    (LogicalOr
                                      left: 
                                        (BoolBinary
                                          op_id: BoolBinary_GlobDEqual
                                          left: {($ VSub_Name '$githubUserName')}
                                          right: {(DQ )}
                                        )
                                      right: 
                                        (BoolBinary
                                          op_id: BoolBinary_GlobDEqual
                                          left: {($ VSub_Name '$nameOfInstallFile')}
                                          right: {(DQ )}
                                        )
                                    )
                                )
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [
                        {(echo)}
                        {(DQ ('Error: update utility has not been configured correctly.'))}
                      ]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[446])]
                    )
                    (C {(exit)} {(1)})
                  ]
                  spids: [-1 437]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {($ VSub_Name '$latestVersion')}
                              right: {(DQ )}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [{(echo)} {(DQ ('Error: no active internet connection'))}]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[477])]
                    )
                    (C {(exit)} {(1)})
                  ]
                  spids: [455 468]
                )
              ]
              else_action: [
                (If
                  arms: [
                    (if_arm
                      cond: [
                        (Sentence
                          child: 
                            (DBracket
                              expr: 
                                (BoolBinary
                                  op_id: BoolBinary_GlobNEqual
                                  left: {(DQ ($ VSub_Name '$latestVersion'))}
                                  right: {(DQ ($ VSub_Name '$currentVersion'))}
                                )
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [
                        (C {(echo)} {(DQ ('Version ') ($ VSub_Name '$latestVersion') (' available'))})
                        (C {(echo)} {(-n)} 
                          {
                            (DQ ('Do you wish to update ') ($ VSub_Name '$repositoryName') (' [Y/n]: '))
                          }
                        )
                        (C {(read)} {(-r)} {(answer)})
                        (If
                          arms: [
                            (if_arm
                              cond: [
                                (Sentence
                                  child: 
                                    (DBracket
                                      expr: 
                                        (LogicalOr
                                          left: 
                                            (BoolBinary
                                              op_id: BoolBinary_GlobDEqual
                                              left: {(DQ ($ VSub_Name '$answer'))}
                                              right: {(DQ (Y))}
                                            )
                                          right: 
                                            (BoolBinary
                                              op_id: BoolBinary_GlobDEqual
                                              left: {(DQ ($ VSub_Name '$answer'))}
                                              right: {(DQ (y))}
                                            )
                                        )
                                    )
                                  terminator: <Op_Semi ';'>
                                )
                              ]
                              action: [
                                (AndOr
                                  children: [
                                    (C {(cd)} {(TildeSubPart prefix:'')})
                                    (BraceGroup
                                      children: [
                                        (Sentence
                                          child: (C {(echo)} {(SQ <'Update Failed'>)})
                                          terminator: <Op_Semi ';'>
                                        )
                                        (Sentence
                                          child: (C {(exit)} {(1)})
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [574]
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                                (If
                                  arms: [
                                    (if_arm
                                      cond: [
                                        (Sentence
                                          child: 
                                            (DBracket
                                              expr: 
                                                (BoolUnary
                                                  op_id: BoolUnary_d
                                                  child: 
                                                    {(Lit_Tilde '~') (/) 
                                                      ($ VSub_Name '$repositoryName')
                                                    }
                                                )
                                            )
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      action: [
                                        (Sentence
                                          child: 
                                            (AndOr
                                              children: [
                                                (C {(rm)} {(-r)} {(-f)} {($ VSub_Name '$repositoryName')})
                                                (BraceGroup
                                                  children: [
                                                    (Sentence
                                                      child: 
                                                        (C {(echo)} 
                                                          {
                                                            (DQ 
                                                              (
'Permissions Error: try running the update as sudo'
                                                              )
                                                            )
                                                          }
                                                        )
                                                      terminator: <Op_Semi ';'>
                                                    )
                                                    (Sentence
                                                      child: (C {(exit)} {(1)})
                                                      terminator: <Op_Semi ';'>
                                                    )
                                                  ]
                                                  spids: [618]
                                                )
                                              ]
                                              op_id: Op_DPipe
                                            )
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [-1 606]
                                    )
                                  ]
                                  spids: [-1 636]
                                )
                                (AndOr
                                  children: [
                                    (C {(git)} {(clone)} 
                                      {
                                        (DQ ('https://github.com/') ($ VSub_Name '$githubUserName') (/) 
                                          ($ VSub_Name '$repositoryName')
                                        )
                                      }
                                    )
                                    (BraceGroup
                                      children: [
                                        (Sentence
                                          child: 
                                            (C {(echo)} {(DQ ("Couldn't download latest version"))})
                                          terminator: <Op_Semi ';'>
                                        )
                                        (Sentence
                                          child: (C {(exit)} {(1)})
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [652]
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                                (AndOr
                                  children: [
                                    (C {(cd)} {($ VSub_Name '$repositoryName')})
                                    (BraceGroup
                                      children: [
                                        (Sentence
                                          child: (C {(echo)} {(SQ <'Update Failed'>)})
                                          terminator: <Op_Semi ';'>
                                        )
                                        (Sentence
                                          child: (C {(exit)} {(1)})
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [676]
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                                (AndOr
                                  children: [
                                    (SimpleCommand
                                      words: [
                                        {(git)}
                                        {(checkout)}
                                        {(DQ (v) ($ VSub_Name '$latestVersion'))}
                                      ]
                                      redirects: [
                                        (Redir
                                          op_id: Redir_Great
                                          fd: 2
                                          arg_word: {(/dev/null)}
                                          spids: [703]
                                        )
                                      ]
                                    )
                                    (AndOr
                                      children: [
                                        (SimpleCommand
                                          words: [
                                            {(git)}
                                            {(checkout)}
                                            {(DQ ($ VSub_Name '$latestVersion'))}
                                          ]
                                          redirects: [
                                            (Redir
                                              op_id: Redir_Great
                                              fd: 2
                                              arg_word: {(/dev/null)}
                                              spids: [717]
                                            )
                                          ]
                                        )
                                        (C {(echo)} 
                                          {
                                            (DQ 
                                              (
"Couldn't git checkout to stable release, updating to latest commit."
                                              )
                                            )
                                          }
                                        )
                                      ]
                                      op_id: Op_DPipe
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                                (C {(chmod)} {(a) (Lit_Other '+') (x)} {(install.sh)})
                                (AndOr
                                  children: [
                                    (C {(./) ($ VSub_Name '$nameOfInstallFile')} {(DQ (update))})
                                    (C {(exit)} {(1)})
                                  ]
                                  op_id: Op_DPipe
                                )
                                (C {(cd)} {(..)})
                                (AndOr
                                  children: [
                                    (C {(rm)} {(-r)} {(-f)} {($ VSub_Name '$repositoryName')})
                                    (BraceGroup
                                      children: [
                                        (Sentence
                                          child: 
                                            (C {(echo)} 
                                              {
                                                (DQ 
                                                  (
'Permissions Error: update succesfull but cannot delete temp files located at ~/'
                                                  ) ($ VSub_Name '$repositoryName') (' delete this directory with sudo')
                                                )
                                              }
                                            )
                                          terminator: <Op_Semi ';'>
                                        )
                                        (Sentence
                                          child: (C {(exit)} {(1)})
                                          terminator: <Op_Semi ';'>
                                        )
                                      ]
                                      spids: [771]
                                    )
                                  ]
                                  op_id: Op_DPipe
                                )
                              ]
                              spids: [-1 565]
                            )
                          ]
                          else_action: [(C {(exit)} {(1)})]
                          spids: [790 798]
                        )
                      ]
                      spids: [-1 506]
                    )
                  ]
                  else_action: [
                    (C {(echo)} 
                      {(DQ ($ VSub_Name '$repositoryName') (' is already the latest version'))}
                    )
                  ]
                  spids: [801 812]
                )
              ]
              spids: [486 815]
            )
          ]
          spids: [311]
        )
      spids: [307 310]
    )
    (FuncDef
      name: getConfiguredPlayer
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_Name '$OSTYPE'))}
                              right: {(DQ (linux)) (Lit_Other '*')}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: (C {(command)} {(-v)} {(vlc)})
                              terminator: <Op_Amp '&'>
                            )
                            (Sentence
                              child: 
                                (SimpleCommand
                                  redirects: [
                                    (Redir
                                      op_id: Redir_Great
                                      fd: -1
                                      arg_word: {(/dev/null)}
                                      spids: [856]
                                    )
                                  ]
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:player)
                                  op: Equal
                                  rhs: {(DQ (vlc))}
                                  spids: [862]
                                )
                              ]
                              spids: [862]
                            )
                          ]
                          spids: [-1 859]
                        )
                        (if_arm
                          cond: [
                            (Sentence
                              child: (C {(command)} {(-v)} {(mpv)})
                              terminator: <Op_Amp '&'>
                            )
                            (Sentence
                              child: 
                                (SimpleCommand
                                  redirects: [
                                    (Redir
                                      op_id: Redir_Great
                                      fd: -1
                                      arg_word: {(/dev/null)}
                                      spids: [877]
                                    )
                                  ]
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:player)
                                  op: Equal
                                  rhs: {(DQ (mpv))}
                                  spids: [883]
                                )
                              ]
                              spids: [883]
                            )
                          ]
                          spids: [868 880]
                        )
                        (if_arm
                          cond: [
                            (Sentence
                              child: (C {(command)} {(-v)} {(mplayer)})
                              terminator: <Op_Amp '&'>
                            )
                            (Sentence
                              child: 
                                (SimpleCommand
                                  redirects: [
                                    (Redir
                                      op_id: Redir_Great
                                      fd: -1
                                      arg_word: {(/dev/null)}
                                      spids: [898]
                                    )
                                  ]
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:player)
                                  op: Equal
                                  rhs: {(DQ (mplayer))}
                                  spids: [904]
                                )
                              ]
                              spids: [904]
                            )
                          ]
                          spids: [889 901]
                        )
                      ]
                      else_action: [
                        (SimpleCommand
                          words: [
                            {(echo)}
                            {
                              (DQ 
                                (
'Error: no supported video player installed (vlc, mpv or mplayer)'
                                )
                              )
                            }
                          ]
                          redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[919])]
                        )
                        (ControlFlow
                          token: <ControlFlow_Return return>
                          arg_word: {(1)}
                        )
                      ]
                      spids: [910 928]
                    )
                  ]
                  spids: [-1 844]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobDEqual
                              left: {(DQ ($ VSub_Name '$OSTYPE'))}
                              right: {(DQ (darwin)) (Lit_Other '*')}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: 
                                    (BoolUnary
                                      op_id: BoolUnary_f
                                      child: {(/Applications/VLC.app/Contents/MacOS/VLC)}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:player)
                                  op: Equal
                                  rhs: {(DQ (/Applications/VLC.app/Contents/MacOS/VLC))}
                                  spids: [965]
                                )
                              ]
                              spids: [965]
                            )
                          ]
                          spids: [-1 962]
                        )
                      ]
                      else_action: [
                        (SimpleCommand
                          words: [
                            {(echo)}
                            {(DQ ('Error: vlc is not installed and it is required to play videos'))}
                          ]
                          redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[980])]
                        )
                        (ControlFlow
                          token: <ControlFlow_Return return>
                          arg_word: {(1)}
                        )
                      ]
                      spids: [971 989]
                    )
                  ]
                  spids: [931 949]
                )
              ]
              spids: [-1 992]
            )
          ]
          spids: [824]
        )
      spids: [820 823]
    )
    (FuncDef
      name: channelview
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(mkdir)} {(-p)} 
                  {($ VSub_Name '$HOME') (/.cache/ytview/channels/) ($ VSub_Name '$channel')}
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(httpGet)} 
                      {(https) (Lit_Other ':') (//www.youtube.com/user/) ($ VSub_Name '$channel') 
                        (/videos)
                      }
                    )
                    (C {(grep)} {(DQ (Duration))})
                    (C {(awk)} 
                      {
                        (SQ 
                          <
'{print $10 " " $11 " " $12 " " $13 " " $14 " " $15 " " $16 " " $17 " " $18 " " $19 " " $20 " " $21 " " $22 " " $23 " " $24 " " $25 " " $26 " " $27 " " $29}'
                          >
                        )
                      }
                    )
                    (C {(sed)} {(SQ <'s/aria-describedby="description-id.*//'>)})
                    (C {(sed)} {(s/title) (Lit_Other '=') (//)})
                    (C {(sed)} {(SQ <'s/"//'>)})
                    (C {(sed)} {(SQ <'s/"//'>)})
                    (C {(awk)} {(SQ <'{printf "%s.\\t%s\\n",NR,$0}'>)})
                    (C {(sed)} {(s/) (SQ <'&#39;'>) (/) (DQ ("'")) (/g)})
                    (SimpleCommand
                      words: [{(sed)} {(s/) (SQ <'&amp;'>) (/) (SQ <and>) (/g)}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: 
                            {($ VSub_Name '$HOME') (/.cache/ytview/channels/) 
                              ($ VSub_Name '$channel') (/titles.txt)
                            }
                          spids: [1116]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(httpGet)} 
                      {(https) (Lit_Other ':') (//www.youtube.com/user/) ($ VSub_Name '$channel') 
                        (/Videos)
                      }
                    )
                    (C {(grep)} {(DQ ('watch?v='))})
                    (C {(awk)} {(SQ <'{print $6}'>)})
                    (C {(sed)} {(s/spf-link//)})
                    (C {(sed)} {(s/href) (Lit_Other '=') (//)})
                    (C {(sed)} {(SQ <'s/"//'>)})
                    (C {(sed)} {(SQ <'s/"//'>)})
                    (C {(sed)} {(SQ <'/^\\s*$/d'>)})
                    (C {(sed)} {(SQ <'s/\\//https:\\/\\/www.youtube.com\\//'>)})
                    (SimpleCommand
                      words: [{(awk)} {(SQ <'{printf "%s.\\t%s\\n",NR,$0}'>)}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: 
                            {($ VSub_Name '$HOME') (/.cache/ytview/channels/) 
                              ($ VSub_Name '$channel') (/urls.txt)
                            }
                          spids: [1213]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(head)} {(-n)} {(20)} 
                  {($ VSub_Name '$HOME') (/.cache/ytview/channels/) ($ VSub_Name '$channel') 
                    (/titles.txt)
                  }
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (C {(read)} {(-p)} {(DQ ('Choose a video: '))} {(titlenumber)})
            (Sentence
              child: 
                (SimpleCommand
                  words: [
                    {($ VSub_Name '$player')}
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (SimpleCommand
                                    words: [
                                      {(sed)}
                                      {(-n)}
                                      {
                                        (CommandSubPart
                                          command_list: 
                                            (CommandList
                                              children: [(C {(echo)} {($ VSub_Name '$titlenumber')})]
                                            )
                                          left_token: <Left_CommandSub '$('>
                                          spids: [1280 1284]
                                        ) (p)
                                      }
                                    ]
                                    redirects: [
                                      (Redir
                                        op_id: Redir_Less
                                        fd: -1
                                        arg_word: 
                                          {($ VSub_Name '$HOME') (/.cache/ytview/channels/) 
                                            ($ VSub_Name '$channel') (/urls.txt)
                                          }
                                        spids: [1287]
                                      )
                                    ]
                                  )
                                  (C {(awk)} {(SQ <'{print $2}'>)})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [1275 1301]
                      )
                    }
                  ]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {(/dev/null)}
                      spids: [1303]
                    )
                    (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[1307])
                  ]
                )
              terminator: <Op_Amp '&'>
            )
          ]
          spids: [1005]
        )
      spids: [1001 1004]
    )
    (FuncDef
      name: searchview
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:search)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(echo)} {($ VSub_Name '$search')})
                                  (C {(tr)} {(DQ (' '))} {(Lit_Other '+')})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [1324 1339]
                      )
                    }
                  spids: [1323]
                )
              ]
              spids: [1323]
            )
            (C {(mkdir)} {(-p)} 
              {($ VSub_Name '$HOME') (/.cache/ytview/searches/) ($ VSub_Name '$search')}
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(httpGet)} 
                      {(https) (Lit_Other ':') (//www.youtube.com/results) 
                        (EscapedLiteralPart token:<Lit_EscapedChar '\\?'>) (search_query) (EscapedLiteralPart token:<Lit_EscapedChar '\\='>) ($ VSub_Name '$search')
                      }
                    )
                    (C {(grep)} {(DQ (Duration))})
                    (C {(grep)} {(DQ ('watch?v='))})
                    (C {(awk)} 
                      {
                        (SQ 
                          <
'{print $13 " " $14 " " $15 " " $16 " " $17 " " $18 " " $19 " " $20 " " $21 " " $22 " " $23 " " $23}'
                          >
                        )
                      }
                    )
                    (C {(sed)} {(SQ <'s/aria-describedby="description-id.*//g'>)})
                    (C {(sed)} {(s/title) (Lit_Other '=') (//)})
                    (C {(sed)} {(SQ <'s/"//g'>)})
                    (C {(sed)} {(s/spf-link//)})
                    (C {(sed)} {(SQ <'s/data-session-link=itct*.//'>)})
                    (C {(sed)} {(s/spf-prefetch//g)})
                    (C {(sed)} {(SQ <'s/rel=//g'>)})
                    (C {(sed)} {(SQ <'s/"//'>)})
                    (C {(awk)} {(SQ <'{printf "%s.\\t%s\\n",NR,$0}'>)})
                    (C {(sed)} {(s/) (SQ <'&#39;'>) (/) (DQ ("'")) (/g)})
                    (SimpleCommand
                      words: [{(sed)} {(s/) (SQ <'&amp;'>) (/) (SQ <and>) (/g)}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: 
                            {($ VSub_Name '$HOME') (/.cache/ytview/searches/) ($ VSub_Name '$search') 
                              (/titles.txt)
                            }
                          spids: [1485]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (Pipeline
                  children: [
                    (C {(httpGet)} 
                      {(https) (Lit_Other ':') (//www.youtube.com/results) 
                        (EscapedLiteralPart token:<Lit_EscapedChar '\\?'>) (search_query) (EscapedLiteralPart token:<Lit_EscapedChar '\\='>) ($ VSub_Name '$search')
                      }
                    )
                    (C {(grep)} {(DQ ('watch?v='))})
                    (C {(awk)} {(SQ <'{print $5}'>)})
                    (C {(sed)} {(s/vve-check//)})
                    (C {(sed)} {(SQ <'s/href="/https:\\/\\/www.youtube.com/'>)})
                    (C {(sed)} {(SQ <'s/"//'>)})
                    (C {(sed)} {(s/class) (Lit_Other '=') (DQ (yt-uix-tile-link)) (//)})
                    (C {(sed)} {(SQ <'/^\\s*$/d'>)})
                    (SimpleCommand
                      words: [{(awk)} {(SQ <'{printf "%s.\\t%s\\n",NR,$0}'>)}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: -1
                          arg_word: 
                            {($ VSub_Name '$HOME') (/.cache/ytview/searches/) ($ VSub_Name '$search') 
                              (/urls.txt)
                            }
                          spids: [1578]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(cat)} 
                  {($ VSub_Name '$HOME') (/.cache/ytview/searches/) ($ VSub_Name '$search') 
                    (/titles.txt)
                  }
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (C {(read)} {(-p)} {(DQ ('Choose a video: '))} {(titlenumber)})
            (Sentence
              child: 
                (SimpleCommand
                  words: [
                    {($ VSub_Name '$player')}
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (SimpleCommand
                                    words: [
                                      {(sed)}
                                      {(-n)}
                                      {
                                        (CommandSubPart
                                          command_list: 
                                            (CommandList
                                              children: [(C {(echo)} {($ VSub_Name '$titlenumber')})]
                                            )
                                          left_token: <Left_CommandSub '$('>
                                          spids: [1638 1642]
                                        ) (p)
                                      }
                                    ]
                                    redirects: [
                                      (Redir
                                        op_id: Redir_Less
                                        fd: -1
                                        arg_word: 
                                          {($ VSub_Name '$HOME') (/.cache/ytview/searches/) 
                                            ($ VSub_Name '$search') (/urls.txt)
                                          }
                                        spids: [1645]
                                      )
                                    ]
                                  )
                                  (C {(awk)} {(SQ <'{print $2}'>)})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [1633 1659]
                      )
                    }
                  ]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {(/dev/null)}
                      spids: [1661]
                    )
                    (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[1665])
                  ]
                )
              terminator: <Op_Amp '&'>
            )
          ]
          spids: [1319]
        )
      spids: [1315 1318]
    )
    (FuncDef
      name: usage
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(DQ (Ytview))})
            (C {(echo)} {(DQ ('Description: Search and play youtube videos right from the terminal.'))})
            (C {(echo)} {(DQ ('Usage: ytview [flag] [string] or ytview [videoToSearch]'))})
            (C {(echo)} {(DQ ('  -s Searches youtube'))})
            (C {(echo)} {(DQ ('  -c Shows the latest videos of a channel'))})
            (C {(echo)} {(DQ ('  -u Update Bash-Snippet Tools'))})
            (C {(echo)} {(DQ ('  -h Show the help'))})
            (C {(echo)} {(DQ ('  -v Get the tool version'))})
            (C {(echo)} {(DQ ('Examples:'))})
            (C {(echo)} {(DQ ('  ytview -s Family Guy Chicken Fight'))})
            (C {(echo)} {(DQ ('  ytview -c Numberphile'))})
          ]
          spids: [1680]
        )
      spids: [1676 1679]
    )
    (AndOr children:[(C {(getConfiguredClient)})(C {(exit)} {(1)})] op_id:Op_DPipe)
    (AndOr children:[(C {(getConfiguredPlayer)})(C {(exit)} {(1)})] op_id:Op_DPipe)
    (AndOr children:[(C {(checkInternet)})(C {(exit)} {(1)})] op_id:Op_DPipe)
    (While
      cond: [
        (C {(getopts)} {(vuc) (Lit_Other ':') (s) (Lit_Other ':') (h) (Lit_Other '*') (Lit_Other ':')} 
          {(option)}
        )
      ]
      body: 
        (DoGroup
          children: [
            (Case
              to_match: {(DQ (${ VSub_Name option))}
              arms: [
                (case_arm
                  pat_list: [{(s)}]
                  action: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: 
                                    (BoolBinary
                                      op_id: BoolBinary_GlobNEqual
                                      left: {($ VSub_Name '$flag')}
                                      right: {(DQ (channel))}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:search)
                                  op: Equal
                                  rhs: 
                                    {
                                      (CommandSubPart
                                        command_list: 
                                          (CommandList
                                            children: [
                                              (C {(printf)} {(SQ <'%s '>)} {(DQ ($ VSub_At '$@'))})
                                            ]
                                          )
                                        left_token: <Left_CommandSub '$('>
                                        spids: [1837 1847]
                                      )
                                    }
                                  spids: [1836]
                                )
                              ]
                              spids: [1836]
                            )
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:flag)
                                  op: Equal
                                  rhs: {(DQ (search))}
                                  spids: [1850]
                                )
                              ]
                              spids: [1850]
                            )
                          ]
                          spids: [-1 1833]
                        )
                      ]
                      else_action: [
                        (SimpleCommand
                          words: [
                            {(echo)}
                            {(DQ ('Error: search and channel options are mutually exclusive'))}
                          ]
                          redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1865])]
                        )
                        (C {(exit)} {(1)})
                      ]
                      spids: [1856 1874]
                    )
                  ]
                  spids: [1815 1816 1877 -1]
                )
                (case_arm
                  pat_list: [{(c)}]
                  action: [
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: 
                                    (BoolBinary
                                      op_id: BoolBinary_GlobNEqual
                                      left: {($ VSub_Name '$flag')}
                                      right: {(DQ (search))}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:channel)
                                  op: Equal
                                  rhs: {(DQ ($ VSub_Name '$OPTARG'))}
                                  spids: [1901]
                                )
                              ]
                              spids: [1901]
                            )
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:flag)
                                  op: Equal
                                  rhs: {(DQ (channel))}
                                  spids: [1907]
                                )
                              ]
                              spids: [1907]
                            )
                          ]
                          spids: [-1 1898]
                        )
                      ]
                      else_action: [
                        (SimpleCommand
                          words: [
                            {(echo)}
                            {(DQ ('Error: search and channel options are mutually exclusive'))}
                          ]
                          redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1922])]
                        )
                        (C {(exit)} {(1)})
                      ]
                      spids: [1913 1931]
                    )
                  ]
                  spids: [1880 1881 1934 -1]
                )
                (case_arm
                  pat_list: [{(h)}]
                  action: [(AndOr children:[(C {(usage)})(C {(exit)} {(0)})] op_id:Op_DAmp)]
                  spids: [1937 1938 1948 -1]
                )
                (case_arm
                  pat_list: [{(u)}]
                  action: [(AndOr children:[(C {(update)})(C {(exit)} {(0)})] op_id:Op_DAmp)]
                  spids: [1951 1952 1962 -1]
                )
                (case_arm
                  pat_list: [{(v)}]
                  action: [
                    (AndOr
                      children: [
                        (C {(echo)} {(DQ ('Version ') ($ VSub_Name '$currentVersion'))})
                        (C {(exit)} {(0)})
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  spids: [1965 1966 1981 -1]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [(AndOr children:[(C {(usage)})(C {(exit)} {(0)})] op_id:Op_DAmp)]
                  spids: [1984 1985 1995 -1]
                )
              ]
              spids: [1804 1812 1998]
            )
          ]
          spids: [1801 2000]
        )
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {($ VSub_Pound '$#')}
                      right: {(DQ (0))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(usage)}) (C {(exit)} {(0)})]
          spids: [-1 2018]
        )
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {($ VSub_Number '$1')}
                      right: {(DQ (help))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(usage)}) (C {(exit)} {(0)})]
          spids: [2028 2042]
        )
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {($ VSub_Number '$1')}
                      right: {(DQ (update))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(update)}) (C {(exit)} {(0)})]
          spids: [2052 2067]
        )
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {($ VSub_Name '$flag')}
                      right: {(DQ (search))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(AndOr children:[(C {(searchview)})(C {(exit)} {(1)})] op_id:Op_DPipe)]
          spids: [2077 2092]
        )
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_GlobDEqual
                      left: {($ VSub_Name '$flag')}
                      right: {(DQ (channel))}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(AndOr children:[(C {(channelview)})(C {(exit)} {(1)})] op_id:Op_DPipe)]
          spids: [2103 2118]
        )
      ]
      else_action: [
        (Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (LhsName name:search)
              op: Equal
              rhs: 
                {
                  (CommandSubPart
                    command_list: 
                      (CommandList
                        children: [(C {(printf)} {(SQ <'%s '>)} {(DQ ($ VSub_At '$@'))})]
                      )
                    left_token: <Left_CommandSub '$('>
                    spids: [2133 2143]
                  )
                }
              spids: [2132]
            )
          ]
          spids: [2132]
        )
        (AndOr children:[(C {(searchview)})(C {(exit)} {(1)})] op_id:Op_DPipe)
      ]
      spids: [2129 2154]
    )
  ]
)