This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

A kind of youtube search script!

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
slasla
Voice
Posts: 5
Joined: Mon May 04, 2009 6:25 pm

A kind of youtube search script!

Post by slasla »

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: Select all

### 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 :)
M
Maiki
Voice
Posts: 28
Joined: Sun May 20, 2007 4:58 pm

Post by Maiki »

Since that is the script i made, i couldn't stand not to help ^-^

Code: Select all

### 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

}
s
slasla
Voice
Posts: 5
Joined: Mon May 04, 2009 6:25 pm

Post by slasla »

Hello Mookie , thank you very much for your reply, but it seems the script doesn't work for me :( have any ideea why ?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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.
<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: Select all

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: Select all

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.. :D
s
slasla
Voice
Posts: 5
Joined: Mon May 04, 2009 6:25 pm

Post by slasla »

Ok, i just edit it , 10x Now i'll wait for the next suggestion to get results :D
s
slasla
Voice
Posts: 5
Joined: Mon May 04, 2009 6:25 pm

Post by slasla »

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 :)
s
slasla
Voice
Posts: 5
Joined: Mon May 04, 2009 6:25 pm

Post by slasla »

up up up :)
d
doggo
Halfop
Posts: 97
Joined: Tue Jan 05, 2010 7:53 am
Contact:

Post by doggo »

very simple you porn search

.chanset #chan +uporn

Code: Select all

# 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: Select all

[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
Post Reply