YouTube Link Name for BOT

By Slyvar on Mar 26, 2011

THIS SCRIPT BY N3m3s1s

Edited by Me

WHAT IT DOES : Shows the name of the YouTube video posted by any kind of users and this was made for BOTS but it can be used for a user's Client

How to Setup : Press ALT+R to Open the Remotes Screen, Click on file and then New then Paste the Snippet in the blank page. then Click on File again and Click on Save As and Type a unique name for it and it should end with .mrc Example : YouTubeVideoLink'sName.mrc


Credits goes For N3m3s1s

*****     YouTube Video Name            *****
*****          By: N3m3sis                     *****
***********************************************

alias youtube { 
  %ytube1 = $remove($1,http://,www.,youtube,.com)
  sockopen youtube www.youtube.com 80 
}
on *:SOCKOPEN:youtube: {
  sockwrite -n $sockname GET %ytube1 HTTP/1.1
  sockwrite -n $sockname Host: www.youtube.com
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname Content-Type: text/html
  sockwrite -n $sockname $crlf 
}
on *:SOCKREAD:youtube: {
  sockread %ytube2
  if (%ytube2 == $null) && (%sockread == $null) { 
    msg %ytube3 1,0You0,4Tube Error. cannot Retrieve Info about Video
    set %sockread 1 
  }
  elseif (%ytube2 == $null) && (%sockread != $null) { noop }
  elseif (<meta name="title" content=" isin %ytube2) { 
    msg %ytube3 1,0You0,4Tube 4Link'1s Name : 1 $remove(%ytube2,<meta name="title" content=",">,&amp;quot;) 
  }
}
on *:TEXT:*youtube*:#: {
  %ytube3 = $chan
  %ytube4 = 1
  while ([ $chr(36) $+ [ %ytube4 ]  ]) {
    if (www.youtube.com/watch?v= isin [ $chr(36) $+ [ %ytube4 ]  ]) { 
      sockclose youtube
      youtube [ $chr(36) $+ [ %ytube4 ]  ] 
    }
    inc %ytube4
  }
}

#EOF 

Comments

Sign in to comment.
N3M3S1S   -  Apr 02, 2011

@SoulMuncher It was a fore mentioned if that Slyvar used/ripped my script as a guide/reference. It does indeed look "ripped" from my original code, but I do not care. If I was worried about, or didn't want people using my scripts to learn from and use them, I wouldn't post them here. Also, this youtube script is an older script that I made, my styles and syntaxes have since improved since then, just so you know ;)

@Slyvar You ripped my code, there is no need to be dishonest about it, I won't be angry. You could've just said something or whatever. I posted this snippet so that people could learn from it. What I suggest to you: start over with this code. Use what you have and re-create you're own snippet and use your own style of coding instead of mine, as it is apparent that your version was derived my YouTube Info 1.3, it is an old version and needs revising.

 Respond  
Slyvar   -  Apr 01, 2011

Thank you Jethro_ :)

 Respond  
Jethro   -  Apr 01, 2011

Come on SoulMuncher, cut Slyvar some slack. You should be sounding encouraging, rather than critical of someone learning of socket. We all have been there, taking other people's codes, dissecting them, and reading it into something we can understand gradually. There's nothing wrong with imitating other people's scripts; in fact, it helps to improve our ability to code something we haven't a clue about to begin with. Keep it up Slyvar, don't let anybody else steer you in a disappointing direction.

 Respond  
Slyvar   -  Apr 01, 2011

Okay, so if it comes to this, then you think I ripped it from somewhere, oh, Okay, but I didn't really Ripped it from him, and I don't know the website it was posted because I surfed into many links to go there. and I followed some person's Instructions step by step to make this Script and that person Explained why some scripts don't work anymore cus Youtube changed their links names. and if its like that

So be it : this script is by N3m3s1s But I didn't steal it from a Certain person, it was there. with a Step by Step tutorial.

 Respond  
SoulMuncher   -  Apr 01, 2011

then you should post those links slyvar.
with just a quick look at this code it's obviously unique. my guess is that this is n3m3s1s's style of coding.
this is not needed.

  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname Content-Type: text/html

these are already defaults for youtube servers.

nobody does this

if (%ytube2 == $null) && (%sockread == $null) { noop }

this would be more normal

if (!%ytube2) && (!%sockreadl) { noop }

but most people would use a positive check for this anyway.

also %sockread isn't even needed. a simple check for could be used to close the socket if it dropped past the title check.

and this:

while ([ $chr(36) $+ [ %ytube4 ]  ]) {

thats really abnormal.
this would be more normal

while ($+($,%ytube4)) {

and even with that the method used here is very unique and not something you most would even think of.
this would be a more rational approach.

on *:TEXT:*youtube*:#: {
  while ($1) {
    if (www.youtube.com/watch?v= isin $1) { 
      sockclose youtube
      youtube $1
    }
    tokenize 32 $2-
  }
}

and even that is in error because it still checks every token for a link just because youtube was said in a channel.
most people would just check for the link in the on text event.

i could keep going ....
everything about this code is unique and NONE of it is YOURS.

changing variable names and channel messages slightly is not writing a script. you didn't write any of this and you should be ashamed for posting it.
at least conform to the rules and post the link that you ripped it from.

 Respond  
Slyvar   -  Apr 01, 2011

lol

 Respond  
napa182   -  Apr 01, 2011

oh il send you a pm with the new ip ;x

 Respond  
Slyvar   -  Apr 01, 2011

lol I don't know Napa, but it isn't connecting o_o

I'll try to connect now

 Respond  
napa182   -  Apr 01, 2011

o.0

Hey Slyvar you seemed to have disappeared from the server. lol

 Respond  
Slyvar   -  Apr 01, 2011

I really Tried nearly every yt Snippet here, Except N3m3s1s's one AND most all of them didn't work, I don't deny that I took some of the snippets in other Websites as a reference, but I didn't copy his one.

 Respond  
SoulMuncher   -  Apr 01, 2011

clearly ripped from here http://www.hawkee.com/snippet/7973/
there is a ZERO percent chance that you coded this in the same strange way as n3m3s1s did his. no offense intended to n3m3s1s, but the coding methods that he used here are unique to say the least.

just admit that you used his code and post the credits at the top slyvar. at this point you just look foolish.

 Respond  
Slyvar   -  Apr 01, 2011

Thanks, Jethro_ :D

 Respond  
Jethro   -  Apr 01, 2011

The "Connection: Keep-Alive" instructs a web server to keep the connection persistent. It's useful to submit subsequent requests. This, in turn, prevents a socket from having to be established every time a client needs to fetch something from the server. A persistent socket will eventually get a time-out connection and get closed by itself anyway. It takes longer time, though, than instructs the server to close it immediately after a data you want is received. If you mainly opt for a main info to be requested, using "Connection: close" is your wise choice.

 Respond  
Slyvar   -  Apr 01, 2011

oh, thank you for clearing this to me, Appreciated.

 Respond  
N3M3S1S   -  Apr 01, 2011

thank you for showing me the Connection thing, I thought if I leave the Connection Sock name Keep-Alive that it would be faster way to show the name of the YT Link.

A understandable reason, but no. In this case, If you have it set to Keep-Alive, it can cause errors in the script, as mine also used to be set to Keep-Alive, but I would keep having problems after a certain amount of youtube links would be posted in a certain amount of time, and it was suggest to me as it was suggest to you, and I changed it to Close, and the problem disappeared :)

The only time I've noticed that Keep-Alive is useful when using sockets if you need to maintain the connection to the socket. In this case, you don't have to do that.

 Respond  
Slyvar   -  Apr 01, 2011

Small world isn't it? I really didn't see your Snippet :o

but it looks like it, soooo, I took some snippets as Reference but didn't copy any of them.

The original Idea of making this script was because I rally wanted to have one but all the other Snippets I tried posted by some of the Users here didn't work.

thank you for showing me the Connection thing, I thought if I leave the Connection Sock name Keep-Alive that it would be faster way to show the name of the YT Link.

:D

 Respond  
N3M3S1S   -  Apr 01, 2011

Nice job, did you use mine as a guide? It looks the same. :P

http://www.hawkee.com/snippet/7973/

Might I suggest that you change this

sockwrite -n $sockname Connection: Keep-Alive

to

sockwrite -n $sockname Connection: Close

The reason being is that if you use Keep-Alive then the socket just stays open after the info is received and just stays open. When you use Close instead, it will close the socket immediately after the information is received.

 Respond  
Callumlord   -  Mar 26, 2011

np :)

 Respond  
Slyvar   -  Mar 26, 2011

Thanks Callumlord :D

 Respond  
Callumlord   -  Mar 26, 2011

Nice :P :)

 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.