youtube info (use $json)

By thegingon on Mar 11, 2012

Screenshots

2 snippet 1 code !!!
*****need json for this snippets so if i don't have $json download it from here
http://pastebin.com/JAB6xHTA


how can i use color in Description ?

  1. youtube info
    write youtube link in the chan

    http://www.youtube.com/watch?v=zYxkezUr8MQ&feature=player_embedded
    [19:49:35] [1,0You0,4Tube] title: Nirvana - Smells Like Teen Spirit (lyrics) Author: zibzib20 views: 14297812 time: 5:02 added: 2008-11-25
    [19:49:35] description: These are the lyrics to Smells Like Teen Spirit. I noticed how lots of people were getting them wrong so I decided to make my own vid. I also added a few nice pictures. Don't expect anything too good, it's my first vid. Enjoy :)

2.youtube search
syntex !youtube what i look for

[19:52:17] !tube Smells Like Teen Spirit
[19:52:17] [1,0You0,4Tube]  title Nirvana - Smells Like Teen Spirit (lyrics) Length 5:02 type Music views 14298481 added 2008-11-25 link http://www.youtube.com/watch?v=zYxkezUr8MQ&feature=youtube_gdata_player
[19:52:17] description These are the lyrics to Smells Like Teen Spirit. I noticed how lots of people were getting them wrong so I decided to make my own vid. I also added a few nice pictures. Don't expect anything too good, it's my first vid. Enjoy :)

credit to this snippet for about the The design - http://www.hawkee.com/snippet/6911/

*****need json for this snippets so if i don't have $json download it from here
http://pastebin.com/JAB6xHTA


on *:text:!tube *:#:{
  set %tube.site http://gdata.youtube.com/feeds/api/videos?q= $+ $2- $+ &v=2&alt=jsonc&max-results=2&start-index=1
  set %tube.1.title $json(%tube.site,data,items,0,title)
  set %tube.1.time.min $round($calc($json(%tube.site,data,items,0,duration) / 60 ),0)
  set %tube.1.time.sec $calc($json(%tube.site,data,items,0,duration) - $calc(%tube.1.time.min * 60))
  if (%tube.1.time.sec < 10) { set %tube.1.time %tube.1.time.min $+ :0 $+ %tube.1.time.sec }
  if (%tube.1.time.sec >= 10) { set %tube.1.time %tube.1.time.min $+ : $+ %tube.1.time.sec }
  set %tube.1.type $json(%tube.site,data,items,0,category)
  set %tube.1.uploader $json(%tube.site,data,items,0,uploader)
  set %tube.1.view $json(%tube.site,data,items,0,viewCount)
  set %tube.uploaded $mid( $json(%tube.site,data,items,0,uploaded),1,10)
  set %tube.1.link $json(%tube.site,data,items,0,player,default)
  set %tube.1.id $json(%tube.site,data,items,0,id)
  set %tube.1.desc $mid($json(http://gdata.youtube.com/feeds/api/videos/ $+ %tube.1.id $+ ?v=2&alt=jsonc,data,description),1,229)
  msg $chan [1,0You0,4Tube] 4Title  $+ %tube.1.title 4Length  $+ %tube.1.time 4Type  $+ %tube.1.type 4Views  $+ %tube.1.view 4 Added  $+ %tube.uploaded 4link  $+ %tube.1.link
  msg $chan 4description  $+ %tube.1.desc
  unset %tube.*
}
on *:text:*:#:{
  if (*http://www.youtube.com/watch?v=* iswm $1-) {
    var %tube.link $strip($wildtok($1-,*http://www.youtube.com/watch?v=*,1,32))
    set %tube.bid $remove(%tube.link,http://www.youtube.com/watch?v=)
    set %tube.id $mid(%tube.bid,1,11)
    set %tube.chan $chan
    /youtube
  }
  elseif (*http://www.youtube.com/v/* iswm $1-) {
    set %tube.link $strip($wildtok($1-,*http://www.youtube.com/v/*,1,32))
    set %tube.bid $remove(%tube.link,http://www.youtube.com/v/)
    set %tube.id $mid(%tube.bid,1,11)
    set %tube.chan $chan
    /youtube
  }
  elseif (*http://m.youtube.com/* iswm $1-) {
    set %tube.link $strip($wildtok($1-,*http://m.youtube.com/*,1,32))
    set %tube.bid $remove(%tube.link,http://m.youtube.com/details?v=)
    set %tube.id $mid(%tube.bid,1,11)
    set %tube.chan $chan
    /youtube
  }
}
alias youtube {
  set %tube.title $json(http://gdata.youtube.com/feeds/api/videos/ $+ %tube.id $+ ?v=2&alt=jsonc,data,title)
  set %tube.uploader $json(http://gdata.youtube.com/feeds/api/videos/ $+ %tube.id $+ ?v=2&alt=jsonc,data,uploader)
  set %tube.view $json(http://gdata.youtube.com/feeds/api/videos/ $+ %tube.id $+ ?v=2&alt=jsonc,data,viewCount)
  set %tube.uploaded $mid($json(http://gdata.youtube.com/feeds/api/videos/ $+ %tube.id $+ ?v=2&alt=jsonc,data,uploaded),1,10)
  set %tube.desc $mid($json(http://gdata.youtube.com/feeds/api/videos/ $+ %tube.id $+ ?v=2&alt=jsonc,data,description),1,229)
  set %tube.time.min $round($calc($json(http://gdata.youtube.com/feeds/api/videos/ $+ %tube.id $+ ?v=2&alt=jsonc,data,duration) / 60 ),0)
  set %tube.time.sec $calc($json(http://gdata.youtube.com/feeds/api/videos/ $+ %tube.id $+ ?v=2&alt=jsonc,data,duration) - $calc(%tube.time.min * 60))
  if (%tube.time.sec < 10) { set %tube.time %tube.time.min $+ :0 $+ %tube.time.sec }
  if (%tube.time.sec >= 10) { set %tube.time %tube.time.min $+ : $+ %tube.time.sec }
  msg %tube.chan [1,0You0,4Tube] title:  $+ %tube.title Author:  $+ %tube.uploader views:  $+ %tube.view time:  $+ %tube.time added:  $+ %tube.uploaded 
  msg %tube.chan description:  $+ %tube.desc
  unset %tube.*
}

Comments

Sign in to comment.
^WeSt   -  Feb 15, 2013

http://www.youtube.com/watch?v=E-cbEGlo-D8

The Time: is incorrect!!

also in !tube command same problem !!!

and https:// does NOT working add https support!

 Respond  
ellhnas   -  Aug 20, 2012

thegingon

Bot say [ - [YouTube] Title Length 0:00 Type Views Added link - ]
<@nEGaTiVE^> [ - description - ] again and again :/

 Respond  
thegingon   -  Mar 13, 2012

@1.MakiMaki it's will very help me if u'l give me all the youtube link formats.

  1. it's easier to me to work with set , thats all
 Respond  
FelicianoX   -  Mar 12, 2012

The JSON script is in the description. I agree to the rest.

 Respond  
  -  Mar 12, 2012

First off your missing the JSON that should be added in the posted code.
Next is the ton load of set var then the messy unset var. you could of used local var
Next you have all that code and not even supporting all the youtube link formats.
I think you should re do this and make sure you post all the needed code for it to work.

 Respond  
FelicianoX   -  Mar 11, 2012

Unknown paste ID for the JSON.
Repasted it for you: http://pastebin.com/JAB6xHTA

 Respond  
thegingon   -  Mar 11, 2012

about what $json do or about this snippet

this snippets:

  1. youtube link info
  2. !tube - youtube search
 Respond  
Jethro   -  Mar 11, 2012

I'm a bit confused about what this snippet does exactly.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.