mIRC Home    About    Download    Register    News    Help

Print Thread
YoutubeTitle + sock script - not longer working #250299 08/01/15 03:08 PM
Joined: Aug 2014
Posts: 42
K
Krawalli Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Hey all,
i used this script for posting the youtube title from a youtube link, but the script brokes, can anyone fix it? smile

Code:
alias -l sockopenmark { sockopen $1-3 | sockmark $1 $4- }
on $*:text:/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si:*: {
  sockopenmark $+(yt.,$calc($ticks + $rand(1,99)))  www.youtube.com 80 $regml(2) msg $iif($chan,$v1,$nick))
}
on *:sockopen:yt.*:{
  tokenize 32 $sock($sockname).mark
  sockwrite -n $sockname GET /watch?v= $+ $1 HTTP/1.0 
  sockwrite -n $sockname HOST: www.youtube.com $+ $str($crlf,2)
}
on *:sockread:yt.*:{
  var %v  |  sockread %v
  if ($regex(%v,/"name" content="(.+)"/)) { 
    tokenize 32 $sock($sockname).mark
    $2-4 $replace($regml(1),&,$chr(38),',$chr(39),',$chr(39),",$chr(34),",$chr(34),&,$chr(38)) $5-
    sockclose $sockname
  }
}

Re: YoutubeTitle + sock script - not longer working [Re: Krawalli] #250302 08/01/15 04:11 PM
Joined: Jan 2004
Posts: 1,279
L
Loki12583 Online
Hoopy frood
Online
Hoopy frood
L
Joined: Jan 2004
Posts: 1,279
Looks like they force https, use the -e switch when opening the socket over port 443.

Code:
alias sockopenmark { sockopen -e $1-3 | sockmark $1 $4- }
on $*:text:/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si:*: {
  sockopenmark $+(yt.,$ticks,$rand(1,99)) www.youtube.com 443 $regml(2) msg $iif($chan,$v1,$nick))
}
on *:sockopen:yt.*:{
  tokenize 32 $sock($sockname).mark
  sockwrite -n $sockname GET /watch?v= $+ $1 HTTP/1.0 
  sockwrite -n $sockname HOST: www.youtube.com $+ $str($crlf,2)
}
on *:sockread:yt.*:{
  var %v  |  sockread %v
  if (%v) echo -ag %v
  if ($regex(%v,/"name" content="(.+)"/)) { 
    tokenize 32 $sock($sockname).mark
    $2-4 $replace($regml(1),&,$chr(38),',$chr(39),',$chr(39),",$chr(34),",$chr(34),&,$chr(38)) $5-
    sockclose $sockname
  }
}

Re: YoutubeTitle + sock script - not longer working [Re: Loki12583] #250305 08/01/15 05:55 PM
Joined: Nov 2014
Posts: 32
P
Panda Offline
Ameglian cow
Offline
Ameglian cow
P
Joined: Nov 2014
Posts: 32
This is really cool, but my head 'bout exploded when I tried to make it output like:

$nick just linked to "youtubetitle"

Could you show how to modify the script to do that, please?

Re: YoutubeTitle + sock script - not longer working [Re: Loki12583] #250308 08/01/15 06:18 PM
Joined: Aug 2014
Posts: 42
K
Krawalli Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Edit:/
Thanks loki - is working fine! smile

Last edited by Krawalli; 08/01/15 06:19 PM.