| View previous topic :: View next topic |
| Author |
Message |
slasla Voice
Joined: 04 May 2009 Posts: 5
|
Posted: Tue May 05, 2009 8:53 am Post subject: A kind of youtube search script! |
|
|
Hello, i tried to modify a youtube tcl script to show results from different site , and it's not quite working , this is what i got
| Code: | ### YouTube Searching script. v0.1
### Made by Mookie
### Contact me at Efnet for more information or suggestions
### V0.3 Fixed + added spam protection
package require http
### Settings ###
set youporn(timeout) "600000" ;# Youtube geturl timeout. (better leave this default)
set youporn(results) "5" ;# Results to display
set youporn(trigger) "!youporn" ;# Search trigger
set youporn(spam) "10" ;# Spam protection in seconds
#########################################################
## Don't edit below unless you know what you're doing. ##
#########################################################
bind pub - $::youporn(trigger) youporn
proc youporn {nick uhost hand chan arg} {
if {[info exists ::checks($nick)] && ([clock seconds] - $::checks($nick)) < $::youporn(spam)} { sendmsg $chan "Esti spammer muist ? :-) grija flacau"; return }
set ::checks($nick) [clock seconds]
if {$arg == ""} { putmsg $nick "Utilizare corecta: $::youporn(trigger) cuvinte-cheie"; return }
set form [http::formatQuery $arg search search]
set tok [http::geturl http://www.youporn.com/results?query=&$form -timeout $::youporn(timeout)]
set data [http::data $tok]
http::cleanup $tok
set a "0"
while {[regexp -- {<hl><a href="/watch/.*?">(.*?) </a>(.*)$} $data -> number title data]} {
if {$a == $::youporn(results)} { break }
sendmsg $chan "\[Title: $title Link:http://youporn.com$number\]"
incr a
}
if {![info exists title]} { sendmsg $chan "\002Error:\002 Nimic gasit pentru '$arg'" }
}
proc "sendmsg" { target message } {
sputraw "PRIVMSG [string tolower $target] :$message"
}
proc "sputraw" { text } {
set text [string trim $text]
putdccraw 0 [string length $text\n] $text\n
} |
You can see the orignal script here -> http://downhill.ro/youtube.tcl
Thank you in advance  |
|
| Back to top |
|
 |
Maiki Voice
Joined: 20 May 2007 Posts: 28
|
Posted: Thu May 07, 2009 2:14 pm Post subject: |
|
|
Since that is the script i made, i couldn't stand not to help ^-^
| Code: | ### YouTube Searching script. v0.1
### Made by Mookie
### Contact me at Efnet for more information or suggestions
### V0.3 Fixed + added spam protection
package require http
### Settings ###
set youporn(timeout) "600000" ;# Youtube geturl timeout. (better leave this default)
set youporn(results) "5" ;# Results to display
set youporn(trigger) "!youporn" ;# Search trigger
set youporn(spam) "10" ;# Spam protection in seconds
#########################################################
## Don't edit below unless you know what you're doing. ##
#########################################################
bind pub - $::youporn(trigger) youporn
proc youporn {nick uhost hand chan arg} {
if {[info exists ::checks($nick)] && ([clock seconds] - $::checks($nick)) < $::youporn(spam)} { sendmsg $chan "Esti spammer muist ? :-) grija flacau"; return }
set ::checks($nick) [clock seconds]
if {$arg == ""} { putmsg $nick "Utilizare corecta: $::youporn(trigger) cuvinte-cheie"; return }
set form [http::formatQuery $arg search search]
set tok [http::geturl http://youporn.com/search?query=$form -timeout $::youporn(timeout)]
set data [http::data $tok]
http::cleanup $tok
set a "0"
while {[regexp -- {^.*?<h1><a href=\"/watch/(.*?)\">(.+?)</a></h1>(.*)$} $data -> number title data]} {
if {$a == $::youporn(results)} { break }
sendmsg $chan "\[Title: $title Link:http://youporn.com/watch/$number\]"
incr a
}
if {![info exists title]} { sendmsg $chan "\002Error:\002 Nimic gasit pentru '$arg'" }
}
proc "sendmsg" { target message } {
sputraw "PRIVMSG [string tolower $target] :$message"
}
proc "sputraw" { text } {
set text [string trim $text]
putdccraw 0 [string length $text\n] $text\n
} |
|
|
| Back to top |
|
 |
slasla Voice
Joined: 04 May 2009 Posts: 5
|
Posted: Sat May 09, 2009 2:54 pm Post subject: |
|
|
| Hello Mookie , thank you very much for your reply, but it seems the script doesn't work for me :( have any ideea why ? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat May 09, 2009 3:07 pm Post subject: |
|
|
| slasla wrote: | Hello Mookie , thank you very much for your reply, but it seems the script doesn't work for me have any ideea why ? |
Webby can be used to illustrate what is wrong. It will dump the entire contents of the site to the root of your eggdrop as "webby.txt". Using this I've constructed the regexp below to clearly show what is happening.
| Quote: | <speechles> !webby http://youporn.com/search?query=porn&search=search --header --xheader --html
<bot> YouPorn ( http://tinyurl.com/op2jqw )( 200; application/xhtml+xml; 2612 bytes; 1 redirects )
<bot> Vary=Host,User-Agent,Accept; Server=Apache; Pragma=no-cache; Expires=Tue, 01 Jan 1980 1:00:00 GMT; Date=Sat, 09 May 2009 19:16:05 GMT; Content-Type=application/xhtml+xml; Content-Length=2612; Connection=close; Cache-Control=private, max-age=0, must-revalidate; Cache-Control=no-cache="set-cookie"; Accept-Ranges=bytes
<bot> XHTML 1.0 Transitional//EN
<speechles> !webby http://youporn.com/search?query=porn&search=search --regexp </div> <div>(.*?)<a href="/usc2257--
<bot> regexp capture1 ( WARNING: This website contains explicit adult material.. . You may only enter this website if you are at least 18 years of age, or at least the age of majority in the jurisdiction where you reside or from which you access this website. If you do not meet these requirements, then you do not have permission to use the website.. . Standard data rates may apply. Please consult your carrier for details..
<bot> regexp capture1 ( . Enter . . Leave . . ) |
What's wrong? Notice the "set-cookie" in the cache-control field of the header? Notice the "1 redirects" given by the detail line? Your simply getting the portal entry page you've been redirected to. To have this actually work is pretty straight-forward and simple.
Change these two lines:
| Code: |
set form [http::formatQuery $arg search search]
set tok [http::geturl http://youporn.com/search?query=$form -timeout $::youporn(timeout)]
|
to this and it will work:
| Code: |
set form [http::formatQuery "query" [string map {" " "+"} $arg] user_choice "Enter"]
set tok [http::geturl http://youporn.com/search -query $form -headers [list "referer" "http://youporn.com/search?query=$arg" "Set-Cookie" "age check=1"] |
This will at least get you into the site, but for some reason haven't gotten it yet to give me proper search results... It always assumes "", in a bit I'll figure it out though..  _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
slasla Voice
Joined: 04 May 2009 Posts: 5
|
Posted: Sun May 10, 2009 11:01 am Post subject: |
|
|
| Ok, i just edit it , 10x Now i'll wait for the next suggestion to get results :D |
|
| Back to top |
|
 |
slasla Voice
Joined: 04 May 2009 Posts: 5
|
Posted: Tue May 12, 2009 10:46 am Post subject: |
|
|
| Is there anyone that knows how to get results ? I hope i won't get anyone upset if it finds this script inappropiate , it's just for fun :) |
|
| Back to top |
|
 |
slasla Voice
Joined: 04 May 2009 Posts: 5
|
Posted: Mon Jul 13, 2009 10:51 am Post subject: |
|
|
| up up up :) |
|
| Back to top |
|
 |
doggo Halfop
Joined: 05 Jan 2010 Posts: 97
|
Posted: Thu Apr 29, 2010 7:02 pm Post subject: |
|
|
very simple you porn search
.chanset #chan +uporn
| Code: | # Rls: you_porn.tcl v1.0
# Date: 29/04/10
# Coded by: doggo
# Contact: #a.b.inner-sanctum@EFNET
###################################
## channel flags ##
setudef flag uporn
set userflag "-"
set flagop "h"
## Script Starts Here - DO NOT EDIT BELOW! ##
## you porn straight ##
set straight "-straight"
bind PUB $userflag $straight straightcom
proc straightcom {nick uhost hand chan text} {
global botnick
if {![channel get $chan uporn]} {return 0}
puthelp "NOTICE $nick :\0033http://www.youporn.com/search?query=text&type=straight"
}
## you porn gay ##
set gay "-gay"
bind PUB $userflag $gay gaycom
proc gaycom {nick uhost hand chan text} {
global botnick
if {![channel get $chan uporn]} {return 0}
puthelp "NOTICE $nick :\0033http://www.youporn.com/search?query=$text&type=gay"
}
## you porn cock ##
set cock "-cock"
bind PUB $userflag $cock cockcom
proc cockcom {nick uhost hand chan text} {
global botnick
if {![channel get $chan uporn]} {return 0}
puthelp "NOTICE $nick :\0033http://www.youporn.com/search?query=$text&type=cock"
}
putlog "uporn" |
| Code: | [12:01am] <doggo> -straight boobs
[12:01am] -tsara- http://www.youporn.com/search?query=text&type=straight
[12:01am] <doggo> -gay bareback
[12:01am] -tsara- http://www.youporn.com/search?query=bareback&type=gay
[12:01am] <doggo> -cock wank
[12:01am] -tsara- http://www.youporn.com/search?query=wank&type=cock |
_________________ NON geeky!! http://gotcode4u.com/ |
|
| Back to top |
|
 |
|