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.

capture all websites posted in channel

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

capture all websites posted in channel

Post by Nor7on »

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.
t
tueb
Halfop
Posts: 76
Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:

Post by tueb »

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 ;-)
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
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

Hi.

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

Code: Select all

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

<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.
t
tueb
Halfop
Posts: 76
Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:

Post by tueb »

I hope this works:

Code: Select all

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
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

You need to check if url already exists in file.

Code: Select all

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/
t
tueb
Halfop
Posts: 76
Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:

Post by tueb »

right, thx
#Quiz.de @ irc.GameSurge.net
JavaChat
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

Code: Select all

<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"
t
tueb
Halfop
Posts: 76
Joined: Thu Oct 04, 2007 6:09 am
Location: #quiz.de @ irc.gamesurge.net
Contact:

Post by tueb »

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
}
Last edited by tueb on Fri Jan 29, 2010 4:23 pm, edited 1 time in total.
#Quiz.de @ irc.GameSurge.net
JavaChat
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

Hi.

Don't work with: www.
Post Reply