|
Joined: Apr 2014
Posts: 170
Vogon poet
|
OP
Vogon poet
Joined: Apr 2014
Posts: 170 |
So, this used to work. Now, not so much... on *:TEXT:!songrequest &:#ifstudios:{
noop $regex($2,/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si)
if $read(songrequest.txt,nw,$+(*,$2)) {
msg # The Song $gettok($v1,2-,32) is already on my list :)
}
elseif !$regml(2) {
msg # $nick --> You typed invalid youtube url.
}
else {
youtube $2 $chan $nick
}
}
alias -l sockopenmark { sockopen $1-3 | sockmark $1 $4- }
alias -l youtube {
noop $regex($1,/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si)
sockopenmark $+(yt.,$calc($ticks + $rand(1,99))) www.youtube.com 80 $regml(2) msg $2-
}
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.*:{
tokenize 32 $sock($sockname).mark
var %v | sockread %v
if ($regex(%v,/"name" content="(.+)"/)) {
var %song $replace($regml(1),&,$chr(38),',$chr(39),',$chr(39),",$chr(34),",$chr(34),&,$chr(38)) $5-
$2-3 The Song %song has been added to my playlist
write songrequest.txt $4 $+ : %song $+ : https://www.youtube.com/watch?v= $+ $1
sockclose $sockname
}
elseif *</html> iswm %v { $2-3 The Song ( https://www.youtube.com/watch?v= $+ $1 ) is not exists. }
} For example... Me:!songrequest www.youtube.com/watch?v=XbGs_qK2PQA(nothing returned. At all.) ---- Me:!songrequest watch?v=XbGs_qK2PQA Bot: username --> You typed an invalid youtube url Any clues as to why it's not working correctly?
|
|
|
|
Joined: Jan 2004
Posts: 1,361
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,361 |
|
|
|
|
Joined: Apr 2014
Posts: 170
Vogon poet
|
OP
Vogon poet
Joined: Apr 2014
Posts: 170 |
still nothing. Here's what I have: on *:TEXT:!req &:#:{
noop $regex($2,/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si)
if $read(songrequest.txt,nw,$+(*,$2)) {
msg # The Song $gettok($v1,2-,32) is already on my list :)
}
elseif !$regml(2) {
msg # $nick --> You typed invalid youtube url.
}
else {
youtube $2 $chan $nick
}
}
alias -l sockopenmark { sockopen $1-3 | sockmark $1 $4- }
alias -l youtube {
noop $regex($1,/(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),&amp;,$chr(38),&#39;,$chr(39),',$chr(39),&quot;,$chr(34),",$chr(34),&,$chr(38)) $5-
sockclose $sockname
}
}
Last edited by Bramzee; 09/01/15 09:31 PM.
|
|
|
|
Joined: Jan 2015
Posts: 2
Bowl of petunias
|
Bowl of petunias
Joined: Jan 2015
Posts: 2 |
Here this seems to work for me. on *:TEXT:!req &:#:{
echo Trying stuff!
noop $regex($2,/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si)
if $read(songrequest.txt,nw,$+(*,$2)) {
msg # The Song $gettok($v1,2-,32) is already on my list :)
}
elseif !$regml(2) {
msg # $nick --> You typed invalid youtube url.
}
else {
youtube $2 $chan $nick
}
}
alias -l sockopenmark { sockopen -e $1-3 | sockmark $1 $4- }
alias -l youtube {
noop $regex($1,/(youtube\.com)\/.*v=([^&]+)|(youtu\.be)\/(.+)/Si)
sockopenmark $+(yt.,$calc($ticks + $rand(1,99))) www.youtube.com 443 $regml(2) msg $2-
}
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.*:{
tokenize 32 $sock($sockname).mark
var %v | sockread %v
if ($regex(%v,/"name" content="(.+)"/)) {
var %song $replace($regml(1),&amp;,$chr(38),&#39;,$chr(39),',$chr(39),&quot;,$chr(34),",$chr(34),&,$chr(38)) $5-
$2-3 The Song %song has been added to my playlist
write songrequest.txt $4 $+ : %song $+ : https://www.youtube.com/watch?v= $+ $1
sockclose $sockname
}
elseif *</html> iswm %v { $2-3 The Song ( https://www.youtube.com/watch?v= $+ $1 ) is not exists. }
}
|
|
|
|
Joined: Apr 2014
Posts: 170
Vogon poet
|
OP
Vogon poet
Joined: Apr 2014
Posts: 170 |
Thanks Grim. That worked 
|
|
|
|
Joined: Nov 2014
Posts: 79
Babel fish
|
Babel fish
Joined: Nov 2014
Posts: 79 |
I hate to be that guy, but I guess I'll have to be. But is there any way to make it play the video within the script itself or do I need an outside program?
I was thinking, since you already have the web address can you used a $read to read the url on the text file and the open it up with /url? I know it has some issues like timing, but can you use the length of the video as a timer between it opening the first video and second video?
I wish I could say I understood half of what you typed but unfortunately I'm just a novice at this.
|
|
|
|
|