Sign in to follow this  
chain

Youtube Video Searcher and Downloader

searches for videos on youtube and shows some info for them, double click on one to download it

 

on *:load:if (!$isdir(YouTube Videos)) mkdir "YouTube Videos"

alias yvs { dialog $iif($dialog(yvs),-v,-md) yvs yvs }

dialog -l yvs {

  title "Youtube Video Searcher"

  size -1 -1 157 44

  option dbu

  box "Search", 1, 0 0 156 48

  edit "", 2, 8 9 140 10

  button "Search", 3, 63 21 36 12

  text "Click Search to Search www.youtube.com", 4, 0 35 156 8, center

  box "Results", 5, 0 48 156 124

  list 6, 4 57 148 111, size

  box "Video Search Info", 7, 0 172 156 64

  text "Name:", 8, 6 182 18 8

  edit "", 9, 30 181 122 10, read autohs

  text "Length:", 10, 6 194 21 8

  edit "", 11, 29 193 44 10, read autohs

  text "Rating:", 12, 78 194 19 8

  edit "", 13, 101 193 50 10, read autohs

  text "Date Added:", 14, 6 205 32 8

  edit "", 15, 44 204 107 10, read autohs

  text "Author:", 16, 78 215 21 8

  edit "", 17, 101 214 50 10, read autohs

  link "", 18, 23 225 109 9

  text "Total Views:", 19, 6 215 30 8

  edit "", 20, 39 214 35 10, read autohs

}

on *:dialog:yvs:*:*: {

  if ($devent == init && !$isdir($mircdirYoutube Videos)) { mkdir "Youtube Videos" }

  elseif ($devent == sclick) {

    if ($did == 3 && $did(2) && !$sock(yvs.yt)) {

      dialog -s yvs -1 -1 314 344

      did -ra yvs 4 Searching www.youtube.com

      did -r yvs 6

      did -ra YVS 5 Results

      if ($hget(YVS)) .hfree YVS

      if ($hget(YTS)) .hfree YTS

      sockopen yvs.yt youtube.com 80

      sockmark yvs.yt $replace($did(2),$chr(32),+)

    }

    elseif ($did == 6) {

      dialog -s yvs -1 -1 314 472

      var %a = 11 18 20 9 17 15 13,%b = 1

      did -ra YVS $replace(%a,$chr(32),$chr(44))

      while ($gettok(%a,%b,32)) {

        did -ra YVS $v1 $iif($gettok($hget(YVS,$did(6).sel),%b,9),$v1,Not Found.)

        inc %b

      }

    }

    elseif ($did == 18) { url -an $did(18) }

  }

  elseif ($devent == dclick && $did(6).sel) {

    yt.s $gettok($hget(YVS,$did(6).sel),2,9)

    .hadd -m YTS Name $did(6).seltext

  }

}

on *:sockopen:yvs.yt: {

  sockwrite -nt $sockname GET $+(/results?search_query=,$sock($sockname).mark,&search_type=&aq=f) HTTP/1.1

  sockwrite -n $sockname HOST: youtube.com $+ $crlf $+ $crlf

}

on *:sockread:yvs.yt: {

  var %yt | sockread %yt

  if (No videos found for isin %yt) {

    sockclose $sockname

    did -ra YVS 4 No Videos Found.

    dialog -s YVS -1 -1 314 96

  }

  elseif ($regex(%yt,/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this