egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

capture all websites posted in channel

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Sun Jan 24, 2010 5:42 pm    Post subject: capture all websites posted in channel Reply with quote

Hi

Can make someone a script for my eggdrop catch all website posted in the channel and save it in a file.

And when someone put: !webs the eggdrop giveme a list with all website's captured in all day.
maybe can have a option for read the websites captured of other days ago.

thanks.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Tue Jan 26, 2010 4:36 pm    Post subject: Reply with quote

hi, i haven't tested it yet, so theres probably at least one typo in it. let me know if you have problems with it.

commands:

!web
and
!web 01252010 to get yesterdays urls. (please tell me a better command for this ;-)

Quote:
bind pubm - * url_pubm
bind pub -|- !web url_pub

set urllogfilename "urllog.data"

proc url_pubm {nick host handle channel text} {
global urllogfilename

foreach word [split $text] {
if {[string length $word] >= 5 && [regexp {^(f|ht)tp(s|)://} $word] && ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {

set day [clock format [clock sec] -format %D]
regsub -all {/} $day "" day

set file [open $urllogfilename a]
puts $file "$day $word"
close $file
}
}

proc url_pub {nick host handle channel text} {
global urllogfilename

if {[file exists $urllogfilename]&& [file readable $urllogfilename]} {

set fp [open $urllogfilename r]
set data [read $fp]
close $fp

foreach line [split $data \n] {
if {$text == ""} {
set text [clock format [clock sec] -format %D]
regsub -all {/} $text "" text
}

if {[lindex [split $line] 0] == $text} {
putserv "PRIVMSG $channel :line"
}
}
}
}



ps: posting killed my formatting o.o
_________________
#Quiz.de @ irc.GameSurge.net
JavaChat
Back to top
View user's profile Send private message Visit poster's website
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Tue Jan 26, 2010 5:03 pm    Post subject: Reply with quote

Hi.

I fix something littles error's, and it work.

Code:
bind pubm - * url_pubm
bind pub -|- !web url_pub

set urllogfilename "urllog.data"

proc url_pubm {nick host handle channel text} {
global urllogfilename

foreach word [split $text] {
if {[string length $word] >= 5 && [regexp {^(f|ht)tp(s|)://} $word] && ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {

set day [clock format [clock sec] -format %D]
regsub -all {/} $day "" day

set file [open $urllogfilename a]
puts $file "$day $word"
close $file
}
}
}

proc url_pub {nick host handle channel text} {
global urllogfilename

if {[file exists $urllogfilename]&& [file readable $urllogfilename]} {

set fp [open $urllogfilename r]
set data [read $fp]
close $fp

foreach line [split $data \n] {
if {$text == ""} {
set text [clock format [clock sec] -format %D]
regsub -all {/} $text "" text
}

if {[lindex [split $line] 0] == $text} {
putserv "PRIVMSG $nick :$line"
}
}
}
}


Code:
<Chasse> 01262010 http://www.youtube.com/watch?v=iyGBBIKS4f8


Maybe can add the nick who posted the website?
Date - Url - Nick - Ident@host.

Ex:
<Chasse> 01262010 - http://www.youtube.com/watch?v=iyGBBIKS4f8 - Nickname - ( nickname!ident@host )

And add for work too with "www."

Thanks tueb.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Thu Jan 28, 2010 1:53 pm    Post subject: Reply with quote

I hope this works:

Code:

bind pubm - * url_pubm
bind pub -|- !web url_pub

set urllogfilename "urllog.data"

proc url_pubm {nick host handle channel text} {
global urllogfilename

  foreach word [split $text] {
    if {[string length $word] >= 5 && {[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www//} $word]}&& ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {

      set day [clock format [clock sec] -format %D]
      regsub -all {/} $day "" day

      set file [open $urllogfilename a]
      puts $file "$day - $word - $nick - $host"
      close $file
    }
  }
}

proc url_pub {nick host handle channel text} {
global urllogfilename

  if {[file exists $urllogfilename]&& [file readable $urllogfilename]} {

    set fp [open $urllogfilename r]
    set data [read $fp]
    close $fp

    foreach line [split $data \n] {
      if {$text == ""} {
      set text [clock format [clock sec] -format %D]
      regsub -all {/} $text "" text
    }

    if {[lindex [split $line] 0] == $text} {
        putserv "PRIVMSG $nick :$line"
    }
    }
  }
}



Im not sure if it will still work if you remove the two lines saying "#regsub -all {/} $day "" day". this qould make the date format more readable.

greetings,

tueb
_________________
#Quiz.de @ irc.GameSurge.net
JavaChat
Back to top
View user's profile Send private message Visit poster's website
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Thu Jan 28, 2010 4:05 pm    Post subject: Reply with quote

You need to check if url already exists in file.
Code:
bind pubm - * url_pubm
bind pub -|- !web url_pub

set urllogfilename "urllog.data"

proc url_pubm {nick host handle channel text} {
global urllogfilename

  foreach word [split $text] {
    if {[string length $word] >= 5 && {[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www//} $word]}&& ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {

      set day [clock format [clock sec] -format %D]
      regsub -all {/} $day "" day

    if {[url_existstitle "$word"] eq "1"} {
        putlog "$word already exists in $urllogfilename"
        return 0
    } else {
      set file [open $urllogfilename a]
      puts $file "$day - $word - $nick - $host"
      close $file
    }

    }
  }
}

proc url_pub {nick host handle channel text} {
global urllogfilename

  if {[file exists $urllogfilename]&& [file readable $urllogfilename]} {

    set fp [open $urllogfilename r]
    set data [read $fp]
    close $fp

    foreach line [split $data \n] {
      if {$text == ""} {
      set text [clock format [clock sec] -format %D]
      regsub -all {/} $text "" text
    }

    if {[lindex [split $line] 0] == $text} {
        putserv "PRIVMSG $nick :$line"
    }
    }
  }
}

    proc url_existstitle {query} {
global urllogfilename

    set file [open $urllogfilename r]
    set data [read $file]
    close $file
        foreach line [split $data \n] {
        if {![string match -nocase "*$query*" "*$line*"]} {
            continue
        }
        if {[string match -nocase "*$query*" "*$line*"]} {
            catch {unset data}
            return 1
        }
    }
    catch {unset data}
    return 0
    }

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Thu Jan 28, 2010 6:56 pm    Post subject: Reply with quote

right, thx
_________________
#Quiz.de @ irc.GameSurge.net
JavaChat
Back to top
View user's profile Send private message Visit poster's website
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Fri Jan 29, 2010 10:19 am    Post subject: Reply with quote

Code:
<Chasse> [14:18] Tcl error [url_pubm]: expected boolean value but got "[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www"
<\Nor7on> .set errorInfo
<Chasse> Currently: expected boolean value but got "[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www"
<Chasse> Currently:     while executing
<Chasse> Currently: "if {[string length $word] >= 5 && {[regexp {^(f|ht)tp(s|)://} $word] || [regexp {^www//} $word]}&& ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $wor..."
<Chasse> Currently:     (procedure "url_pubm" line 5)
<Chasse> Currently:     invoked from within
<Chasse> Currently: "url_pubm $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5"
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
tueb
Halfop


Joined: 04 Oct 2007
Posts: 76
Location: #quiz.de @ irc.gamesurge.net

PostPosted: Fri Jan 29, 2010 4:07 pm    Post subject: Reply with quote

Quote:
bind pubm - * url_pubm
bind pub -|- !web url_pub

set urllogfilename "urllog.data"

proc url_pubm {nick host handle channel text} {
global urllogfilename

foreach word [split $text] {
if {[string length $word] >= 5 && ([regexp {^(f|ht)tp(s|)://} $word] || [regexp "www." $word]) && ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {

set day [clock format [clock sec] -format %D]
regsub -all {/} $day "" day

if {[url_existstitle "$word"] eq "1"} {
putlog "$word already exists in $urllogfilename"
return 0
} else {
set file [open $urllogfilename a]
puts $file "$day - $word - $nick - $host"
close $file
}

}
}
}

proc url_pub {nick host handle channel text} {
global urllogfilename

if {[file exists $urllogfilename] && [file readable $urllogfilename]} {

set fp [open $urllogfilename r]
set data [read $fp]
close $fp

foreach line [split $data \n] {
if {$text == ""} {
set text [clock format [clock sec] -format %D]
regsub -all {/} $text "" text
}

if {[lindex [split $line] 0] == $text} {
putserv "PRIVMSG $nick :$line"
}
}
}
}

proc url_existstitle {query} {
global urllogfilename

set file [open $urllogfilename r]
set data [read $file]
close $file
foreach line [split $data \n] {
if {![string match -nocase "*$query*" "*$line*"]} {
continue
}
if {[string match -nocase "*$query*" "*$line*"]} {
catch {unset data}
return 1
}
}
catch {unset data}
return 0
}

_________________
#Quiz.de @ irc.GameSurge.net
JavaChat


Last edited by tueb on Fri Jan 29, 2010 4:23 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Fri Jan 29, 2010 4:15 pm    Post subject: Reply with quote

Hi.

Don't work with: www.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber