IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   TCL Scriptler (https://www.ircforumlari.net/tcl-scriptler/)
-   -   shorten ( link kısaltma ) Tcl (https://www.ircforumlari.net/tcl-scriptler/602148-shorten-link-kisaltma-tcl.html)

saywhat 25 Temmuz 2014 06:56

shorten ( link kısaltma ) Tcl
 
sabahın bu saatlerinde , AlphaTech (New-York'lu jeff adında bir genç delikanlı) isteği üzerine yaptığım küçük scriptlerden birinide kullanmak isteyen çıkabilir diyerek buraya atayım dedim...
(aslında dün geceden beri 5-6 tane script yaptım aynı çocuğa ama içlerinde başkalarınında işine yarayabilecek hemen hemen bir tek bu var..)

Kod:

package require http

setudef flag shorten

bind pubm -|- "*" is_gd:pubm

proc is_gd:pubm {nick uhost hand chan text} {
    if {![channel get $chan shorten]} { return 0 }
        set text [stripcodes uacgbr $text]
        foreach _ [split $text] {
    if {[regexp -nocase -- {http://([^\s]+)} $_ -> out] || \
        [regexp -nocase -- {https://([^\s]+)} $_ -> out] || \
        [regexp -nocase -- {ftp://([^\s]+)} $_ -> out] || \
        [regexp -nocase -- {
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
out]} {
        putlog "$out"
        set isurl "http://is.gd/api.php?longurl=$out"
        set url [http::geturl "$isurl" -timeout [expr {4*1000}]]
        set data [split [http::data $url] \n]; http::cleanup $url
        regexp {(.*)} $data "" output
        puthelp "privmsg $chan :$nick -> $output"
        return 0
        }
    }
    return 0
}

yaptığı iş kanala yazılanlardan, atılan URL'leri yakalayıp is.gd linkiyle kısaltılmış hale getirmesi. yukarıdaki bu işi oto yapar ..
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
alttaki ise komutla istenen uzun URL'nin kısaltılmış şeklini verir.

Kod:

package require http

setudef flag isgd

bind pub -|- !isgd is_gd

proc is_gd {nick uhost hand chan text} {
    if {![channel get $chan isgd]} { return 0 }
        set query [lindex [split $text] 0]
        set check "http://*|https://*|ftp://*|
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
if {[llength $query] eq "0"} { puthelp "notice $nick :Kullanımı : $::lastbind <URL>"
          return 0
      } elseif {![regexp -nocase -- $check $query]} { puthelp "notice $nick :$query geçerli değil..."
          return 0
      }
     
        set isurl "http://is.gd/api.php?longurl=$query"
        set url [http::geturl "$isurl" -timeout [expr {4*1000}]]
        set data [split [http::data $url] \n]; http::cleanup $url
        regexp {(.*)} $data "" output
        puthelp "privmsg $chan :$nick -> $output"
    return 0
}


saywhat 25 Temmuz 2014 13:19

Cevap: shorten ( link kısaltma ) Tcl
 
kendi botumda kullanmak için daha gelişmiş bir versionunu yaptım ..bu haliyle atılan linki kısa hale çevirmekle birlikte linkin başlığını da yansıtıyor. ayrıca hem aktif edildiği kanalda hemde bot özelinde de aynı işi yapabiliyor...
( bunu kullanmak için tcl sürümü 8.5.x ve yukarısı olmalı ...8.4 ise boşa denemeyin....hata atar..)

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

Kod:

if {[info tclversion] < 8.5} {
  putloglev o * "Bu scripti kullanmak icin en az, Tcl8.5.x ve ustu Tcl surumlerinden biri kurulu olmali. Algilanan surum : $tcl_patchLevel"
  } else {
  putloglev o * "Algilanan Tcl surumu : $tcl_patchLevel shorten.tcl yuklendi.kanal ustunde aktif etmek icin : .chanset #kanal +shorten"
  }
 
package require Tcl 8.5

namespace eval isgd {

package require http

setudef flag shorten

bind pubm - "*" ::isgd::is_gd:pubm
bind msgm - "*" ::isgd::is_gd:msgm

proc is_gd:msgm {nick uhost hand text} {
    ::isgd::is_gd:main $nick $uhost $hand $nick $text
    return 0
    }

proc is_gd:pubm {nick uhost hand chan text} {
    if {![channel get $chan shorten]} { return 0 }
    ::isgd::is_gd:main $nick $uhost $hand $chan $text
    return 0
    }
   
proc is_gd:main {nick uhost hand chan text} {
        set veri [::isgd::check_txt $text]   
        #putlog "$nick -> $veri"
        set isurl "http://is.gd/api.php?longurl=$veri"
        set url [::http::geturl "$isurl" -timeout [expr {4*1000}]]
        set data [split [::http::data $url] \n]
        ::http::cleanup $url
        regexp {(.*)} $data "" output
        set titleurl "http://$veri"
        set turl [::http::geturl "$titleurl" -timeout [expr {4*1000}]]
        set tdata [split [::http::data $turl] \n]
        ::http::cleanup $turl
        regexp {<title>(.*?)</title>} $tdata "" title
      if {![info exists title]} {
        set title "bilgi yok.."
        } elseif {[string match -nocase "error*" $output]} {
        set output "hata oluştu..";}
        lappend cikti $output {*}$title
        puthelp "privmsg $chan :$nick -> $cikti"
        return 0
    }
   
proc check_txt {text} {
        set t [stripcodes bcruag $text]
        foreach _ [split $t] {
    if {[regexp -nocase -- {http://([^\s]+)} $_ -> out] || \
        [regexp -nocase -- {https://([^\s]+)} $_ -> out] || \
        [regexp -nocase -- {ftp://([^\s]+)} $_ -> out] || \
        [regexp -nocase -- {
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
out]} {
          return $out
        }
    }
}       
   
    putlog "ok..."
}


saywhat 25 Temmuz 2014 23:38

Cevap: shorten ( link kısaltma ) Tcl
 
uykumu aldıktan,yemek yiyip, ciğara & kolamı içtikten sonra gelen zihin açıklığıyla gördüm ki; bir güncellemeye daha ihtiyaç var-mışşş...

şöyle ki "kimi sitelerden" alınan </title> başlık, bir takım html kod artıklarını da barındırabildiği ( &bull; , &nbsp; vs vs gibi ) görüldüğünden ;

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

bunları ayıklamak/çözümlemek adına orjinali tcllib htmlparse paketinden olmakla beraber en bilinen kullanımı rus perplexa'nın yıllar evvelki artık çalışmayan ud.tcl scriptinde bu iş için kullandığı prosedür'den faydalanmak , artık "kaçınılmaz bir zorunluluk" olmuştu. (ki kendisinden ,bu tür scriptlerimde, birazda zorunluluk ve yenisini kendim yazmanın ,onca karakteri tek tek bulup tırmalamanın hem zahmetli hemde "gereksiz" olacağını düşünerek,hemde ecnebilerin bu gibi durumlarda kullanmayı sevdiği "tekerleği yeniden icad etmeye uğraşmanın anlamı yok !.. yapılmışı varsa , O'nu kullanacaksın" deyişine uygun olarak kullandığım prosedür) . ki bu InşAllah "son" güncellemeyle ,alınan sonuç istenen/beklenen şekilde oldu...
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] gazamız mübarek olsun...

Kod:

if {[info tclversion] < 8.5} {
  putloglev o * "Bu scripti kullanmak icin en az, Tcl8.5.x ve ustu Tcl surumlerinden biri kurulu olmali. Algilanan surum : $tcl_patchLevel"
  } else {
  putloglev o * "Algilanan Tcl surumu : $tcl_patchLevel shorten.tcl yuklendi.kanal ustunde aktif etmek icin : .chanset #kanal +shorten"
  }
 
package require Tcl 8.5

namespace eval isgd {

package require http

setudef flag shorten
}

bind pubm - "*" ::isgd::is_gd:pubm
bind msgm - "*" ::isgd::is_gd:msgm

proc ::isgd::is_gd:msgm {nick uhost hand text} {
    ::isgd::is_gd:main $nick $uhost $hand $nick $text
    return 0
    }

proc ::isgd::is_gd:pubm {nick uhost hand chan text} {
    if {![channel get $chan shorten]} { return 0 }
    ::isgd::is_gd:main $nick $uhost $hand $chan $text
    return 0
    }
   
proc ::isgd::is_gd:main {nick uhost hand chan text} {
        set veri [::isgd::check_txt $text]   
        #putlog "$nick -> $veri"
        set isurl "http://is.gd/api.php?longurl=$veri"
        set url [::http::geturl "$isurl" -timeout [expr {6*1000}]]
        set data [split [::http::data $url] \n]
        ::http::cleanup $url
        regexp {(.*)} $data "" output
       
        set titleurl "http://$veri"
        set turl [::http::geturl "$titleurl" -timeout [expr {6*1000}]]
        set tdata [split [::http::data $turl] \n]
        ::http::cleanup $turl
        regexp {<title>(.*?)</title>} $tdata "" title
       
      if {![info exists title]} {
        set title "bilgi yok.."
        } elseif {[string match -nocase "*Error*Sorry*" $output]} {
        set output "hata oluştu.."
        putlog "$title - $output"
        return 0
        } else {
        set cikti ""
        lappend cikti \037\00314$output\003\037 \00304->\003 \002 {*}[::isgd::entityToChar $title] \002
        puthelp "privmsg $chan :$nick -> $cikti"
        return 0
        }
  }
   
proc ::isgd::check_txt {text} {
        set t [stripcodes bcruag $text]
        foreach _ [split $t] {
    if {[regexp -nocase -- {http://([^\s]+)} $_ -> out] || \
        [regexp -nocase -- {https://([^\s]+)} $_ -> out] || \
        [regexp -nocase -- {ftp://([^\s]+)} $_ -> out] || \
        [regexp -nocase -- {
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
out]} {
          return $out
        }
    }
}       
   
# perplexa'nın ud.tcl scriptinde kullandığı ,aslı tcllib htmlparse'den alınma,
# html kodları/artıklarını ayıklamakta kullanılan prosedür.
   
proc ::isgd::entityToChar {text {char utf-8}} {
    if {![string match *&* $text]} {return $text}
   
    set escapes {
        &nbsp; \xa0 &iexcl; \xa1 &cent; \xa2 &pound; \xa3 &curren; \xa4
        &yen; \xa5 &brvbar; \xa6 &sect; \xa7 &uml; \xa8 &copy; \xa9
        &ordf; \xaa &laquo; \xab &not; \xac * \xad &reg; \xae
        &macr; \xaf &deg; \xb0 &plusmn; \xb1 ² \xb2 ³ \xb3
        &acute; \xb4 &micro; \xb5 &para; \xb6 &middot; \xb7 &cedil; \xb8
        ¹ \xb9 &ordm; \xba &raquo; \xbb ¼ \xbc ½ \xbd
        ¾ \xbe &iquest; \xbf &Agrave; \xc0 &Aacute; \xc1 &Acirc; \xc2
        &Atilde; \xc3 &Auml; \xc4 &Aring; \xc5 &AElig; \xc6 &Ccedil; \xc7
        &Egrave; \xc8 &Eacute; \xc9 &Ecirc; \xca &Euml; \xcb &Igrave; \xcc
        &Iacute; \xcd &Icirc; \xce &Iuml; \xcf &ETH; \xd0 &Ntilde; \xd1
        &Ograve; \xd2 &Oacute; \xd3 &Ocirc; \xd4 &Otilde; \xd5 &Ouml; \xd6
        &times; \xd7 &Oslash; \xd8 &Ugrave; \xd9 &Uacute; \xda &Ucirc; \xdb
        &Uuml; \xdc &Yacute; \xdd &THORN; \xde &szlig; \xdf &agrave; \xe0
        &aacute; \xe1 &acirc; \xe2 &atilde; \xe3 &auml; \xe4 &aring; \xe5
        &aelig; \xe6 &ccedil; \xe7 &egrave; \xe8 &eacute; \xe9 &ecirc; \xea
        &euml; \xeb &igrave; \xec &iacute; \xed &icirc; \xee &iuml; \xef
        &eth; \xf0 &ntilde; \xf1 &ograve; \xf2 &oacute; \xf3 &ocirc; \xf4
        &otilde; \xf5 &ouml; \xf6 &divide; \xf7 &oslash; \xf8 &ugrave; \xf9
        &uacute; \xfa &ucirc; \xfb &uuml; \xfc &yacute; \xfd &thorn; \xfe
        &yuml; \xff &fnof; \u192 &Alpha; \u391 &Beta; \u392 &Gamma; \u393 &Delta; \u394
        &Epsilon; \u395 &Zeta; \u396 &Eta; \u397 &Theta; \u398 &Iota; \u399
        &Kappa; \u39A &Lambda; \u39B &Mu; \u39C &Nu; \u39D &Xi; \u39E
        &Omicron; \u39F &Pi; \u3A0 &Rho; \u3A1 &Sigma; \u3A3 &Tau; \u3A4
        &Upsilon; \u3A5 &Phi; \u3A6 &Chi; \u3A7 &Psi; \u3A8 &Omega; \u3A9
        &alpha; \u3B1 &beta; \u3B2 &gamma; \u3B3 &delta; \u3B4 &epsilon; \u3B5
        &zeta; \u3B6 &eta; \u3B7 &theta; \u3B8 &iota; \u3B9 &kappa; \u3BA
        &lambda; \u3BB &mu; \u3BC &nu; \u3BD &xi; \u3BE &omicron; \u3BF
        &pi; \u3C0 &rho; \u3C1 &sigmaf; \u3C2 &sigma; \u3C3 &tau; \u3C4
        &upsilon; \u3C5 &phi; \u3C6 &chi; \u3C7 &psi; \u3C8 &omega; \u3C9
        &thetasym; \u3D1 &upsih; \u3D2 &piv; \u3D6 &bull; \u2022
        &hellip; \u2026 &prime; \u2032 &Prime; \u2033 &oline; \u203E
        &frasl; \u2044 &weierp; \u2118 &image; \u2111 &real; \u211C
        &trade; \u2122 &alefsym; \u2135 &larr; \u2190 &uarr; \u2191
        &rarr; \u2192 &darr; \u2193 &harr; \u2194 &crarr; \u21B5
        &lArr; \u21D0 &uArr; \u21D1 &rArr; \u21D2 &dArr; \u21D3 &hArr; \u21D4
        &forall; \u2200 &part; \u2202 &exist; \u2203 &empty; \u2205
        &nabla; \u2207 &isin; \u2208 &notin; \u2209 &ni; \u220B &prod; \u220F
        &sum; \u2211 &minus; \u2212 &lowast; \u2217 &radic; \u221A
        &prop; \u221D &infin; \u221E &ang; \u2220 &and; \u2227 &or; \u2228
        &cap; \u2229 &cup; \u222A &int; \u222B &there4; \u2234 &sim; \u223C
        &cong; \u2245 &asymp; \u2248 &ne; \u2260 &equiv; \u2261 &le; \u2264
        &ge; \u2265 &sub; \u2282 &sup; \u2283 &nsub; \u2284 &sube; \u2286
        &supe; \u2287 &oplus; \u2295 &otimes; \u2297 &perp; \u22A5
        &sdot; \u22C5 &lceil; \u2308 &rceil; \u2309 &lfloor; \u230A
        &rfloor; \u230B &lang; \u2329 &rang; \u232A &loz; \u25CA
        &spades; \u2660 &clubs; \u2663 &hearts; \u2665 &diams; \u2666
        &quot; \x22 &amp; \x26 &lt; \x3C &gt; \x3E O&Elig; \u152 &oelig; \u153
        &Scaron; \u160 &scaron; \u161 &Yuml; \u178 &circ; \u2C6
        &tilde; \u2DC &ensp; \u2002 &emsp; \u2003 &thinsp; \u2009
        &zwnj; \u200C &zwj; \u200D &lrm; \u200E &rlm; \u200F &ndash; \u2013
        &mdash; \u2014 &lsquo; \u2018 &rsquo; \u2019 &sbquo; \u201A
        &ldquo; \u201C &rdquo; \u201D &bdquo; \u201E &dagger; \u2020
        &Dagger; \u2021 &permil; \u2030 &lsaquo; \u2039 &rsaquo; \u203A
        &euro; \u20AC &apos; \u0027 &lrm; "" &rlm; "" ‬ "" * ""
        * ""
    };
   
    set text [string map [list "\]" "\\\]" "\[" "\\\[" "\$" "\\\$" "\\" "\\\\"] [string map $escapes $text]]
    regsub -all -- {&#([[:digit:]]{1,5});} $text {[format %c [string trimleft "\1" "0"]]} text
    regsub -all -- {&#x([[:xdigit:]]{1,4});} $text {[format %c [scan "\1" %x]]} text
    return [subst "$text"]
  }   
   
    putlog "ok..."


saywhat 28 Temmuz 2014 14:04

Cevap: shorten ( link kısaltma ) Tcl
 
güncelleme :

Tls paketi aracılığıyla, https link desteği sağlandı..

Tls nedir,ne işe yarar bilgi için -> [Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] && [Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

Tcl-Tls ayrı bir pakettir. ayrıca kurulması/derlenmesi gerekir.

kurulumu:

Kod:

wget http://garr.dl.sourceforge.net/project/tls/tls/1.6/tls1.6-src.tar.gz
tar -zxf tls1.6-src.tar.gz
cd tls1.6
./configure --prefix=/Tcl'nin/kurulduğu/dizin
make install

script kullanım şekli:

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

Kod:

if {[info tclversion] < 8.5} {
  putloglev o * "Bu scripti kullanmak icin en az, Tcl8.5.x ve ustu Tcl surumlerinden biri kurulu olmali. Algilanan surum : $tcl_patchLevel"
  } else {
  putloglev o * "Algilanan Tcl surumu : $tcl_patchLevel shorten.tcl yuklendi.kanal ustunde aktif etmek icin : .chanset #kanal +shorten"
  }
 
package require Tcl 8.5

namespace eval isgd {
}

package require http

if {![catch {package require tls}]} {
        ::http::register https 443 [list ::tls::socket -require 0 -request 1]
        set var 1
        putlog "Tls bulundu, https desteği var..."
    } else {
        set var 0
        putlog "Tls algilanamadi, https desteği olmayacak."
    }

setudef flag shorten

bind pubm - "*" ::isgd::is_gd:pubm
bind msgm - "*" ::isgd::is_gd:msgm

proc ::isgd::is_gd:msgm {nick uhost hand text} {
    ::isgd::is_gd:main $nick $uhost $hand $nick $text
    }

proc ::isgd::is_gd:pubm {nick uhost hand chan text} {
    if {![channel get $chan shorten]} { return 0 }
    ::isgd::is_gd:main $nick $uhost $hand $chan $text
    }
   
proc ::isgd::is_gd:main {nick uhost hand chan text} {
        set veri [::isgd::check_txt $text]   
        putlog "$nick -> $veri"
        set isurl "http://is.gd/api.php?longurl=$veri"
        ::http::config -useragent "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"
        set url [::http::geturl "$isurl" -timeout [expr {6*1000}]]
        set data [split [::http::data $url] \n]
        ::http::cleanup $url
        regexp {(.*)} $data "" output
       
    if {![info exists output]} {
        set output "hata oluştu..."
        putlog "$output"
        return
        }
       
        set title [::isgd::is_gd:title $text]
        set cikti ""
        lappend cikti \037\00314$output\003\037 \00304->\003 \002 {*}[::isgd::entityToChar $title] \002
        puthelp "privmsg $chan :\00312$nick\003 \00304->\003 $cikti"
        return 0
  }
   
proc ::isgd::is_gd:title {text} {
        set veri [::isgd::check_txt $text]   
        ::http::config -useragent "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"       
        set turl [::http::geturl $veri -timeout [expr {6*1000}]]
        set tdata [split [::http::data $turl] \n]
        ::http::cleanup $turl
        regexp {<title>(.*?)</title>} $tdata "" title
       
    if {![info exists title]} {
        set title "hata...bulunamadı..."
        return $title
        } else {
        return $title
        }
}
   
proc ::isgd::check_txt {text} {
        set t [stripcodes bcruag $text]
        foreach _ [split $t] {
    if {[regexp -nocase -- {(http|ftp|https|
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
out]} {
          return [lindex $out 0]
        }
    }
}       
   
# perplexa'nın ud.tcl scriptinde kullandığı ,aslı tcllib htmlparse'den alınma,
# html kodları/artıklarını ayıklamakta kullanılan prosedür.
   
proc ::isgd::entityToChar {text {char utf-8}} {
    if {![string match *&* $text]} {return $text}
   
    set escapes {
        &nbsp; \xa0 &iexcl; \xa1 &cent; \xa2 &pound; \xa3 &curren; \xa4
        &yen; \xa5 &brvbar; \xa6 &sect; \xa7 &uml; \xa8 &copy; \xa9
        &ordf; \xaa &laquo; \xab &not; \xac * \xad &reg; \xae
        &macr; \xaf &deg; \xb0 &plusmn; \xb1 ² \xb2 ³ \xb3
        &acute; \xb4 &micro; \xb5 &para; \xb6 &middot; \xb7 &cedil; \xb8
        ¹ \xb9 &ordm; \xba &raquo; \xbb ¼ \xbc ½ \xbd
        ¾ \xbe &iquest; \xbf &Agrave; \xc0 &Aacute; \xc1 &Acirc; \xc2
        &Atilde; \xc3 &Auml; \xc4 &Aring; \xc5 &AElig; \xc6 &Ccedil; \xc7
        &Egrave; \xc8 &Eacute; \xc9 &Ecirc; \xca &Euml; \xcb &Igrave; \xcc
        &Iacute; \xcd &Icirc; \xce &Iuml; \xcf &ETH; \xd0 &Ntilde; \xd1
        &Ograve; \xd2 &Oacute; \xd3 &Ocirc; \xd4 &Otilde; \xd5 &Ouml; \xd6
        &times; \xd7 &Oslash; \xd8 &Ugrave; \xd9 &Uacute; \xda &Ucirc; \xdb
        &Uuml; \xdc &Yacute; \xdd &THORN; \xde &szlig; \xdf &agrave; \xe0
        &aacute; \xe1 &acirc; \xe2 &atilde; \xe3 &auml; \xe4 &aring; \xe5
        &aelig; \xe6 &ccedil; \xe7 &egrave; \xe8 &eacute; \xe9 &ecirc; \xea
        &euml; \xeb &igrave; \xec &iacute; \xed &icirc; \xee &iuml; \xef
        &eth; \xf0 &ntilde; \xf1 &ograve; \xf2 &oacute; \xf3 &ocirc; \xf4
        &otilde; \xf5 &ouml; \xf6 &divide; \xf7 &oslash; \xf8 &ugrave; \xf9
        &uacute; \xfa &ucirc; \xfb &uuml; \xfc &yacute; \xfd &thorn; \xfe
        &yuml; \xff &fnof; \u192 &Alpha; \u391 &Beta; \u392 &Gamma; \u393 &Delta; \u394
        &Epsilon; \u395 &Zeta; \u396 &Eta; \u397 &Theta; \u398 &Iota; \u399
        &Kappa; \u39A &Lambda; \u39B &Mu; \u39C &Nu; \u39D &Xi; \u39E
        &Omicron; \u39F &Pi; \u3A0 &Rho; \u3A1 &Sigma; \u3A3 &Tau; \u3A4
        &Upsilon; \u3A5 &Phi; \u3A6 &Chi; \u3A7 &Psi; \u3A8 &Omega; \u3A9
        &alpha; \u3B1 &beta; \u3B2 &gamma; \u3B3 &delta; \u3B4 &epsilon; \u3B5
        &zeta; \u3B6 &eta; \u3B7 &theta; \u3B8 &iota; \u3B9 &kappa; \u3BA
        &lambda; \u3BB &mu; \u3BC &nu; \u3BD &xi; \u3BE &omicron; \u3BF
        &pi; \u3C0 &rho; \u3C1 &sigmaf; \u3C2 &sigma; \u3C3 &tau; \u3C4
        &upsilon; \u3C5 &phi; \u3C6 &chi; \u3C7 &psi; \u3C8 &omega; \u3C9
        &thetasym; \u3D1 &upsih; \u3D2 &piv; \u3D6 &bull; \u2022
        &hellip; \u2026 &prime; \u2032 &Prime; \u2033 &oline; \u203E
        &frasl; \u2044 &weierp; \u2118 &image; \u2111 &real; \u211C
        &trade; \u2122 &alefsym; \u2135 &larr; \u2190 &uarr; \u2191
        &rarr; \u2192 &darr; \u2193 &harr; \u2194 &crarr; \u21B5
        &lArr; \u21D0 &uArr; \u21D1 &rArr; \u21D2 &dArr; \u21D3 &hArr; \u21D4
        &forall; \u2200 &part; \u2202 &exist; \u2203 &empty; \u2205
        &nabla; \u2207 &isin; \u2208 &notin; \u2209 &ni; \u220B &prod; \u220F
        &sum; \u2211 &minus; \u2212 &lowast; \u2217 &radic; \u221A
        &prop; \u221D &infin; \u221E &ang; \u2220 &and; \u2227 &or; \u2228
        &cap; \u2229 &cup; \u222A &int; \u222B &there4; \u2234 &sim; \u223C
        &cong; \u2245 &asymp; \u2248 &ne; \u2260 &equiv; \u2261 &le; \u2264
        &ge; \u2265 &sub; \u2282 &sup; \u2283 &nsub; \u2284 &sube; \u2286
        &supe; \u2287 &oplus; \u2295 &otimes; \u2297 &perp; \u22A5
        &sdot; \u22C5 &lceil; \u2308 &rceil; \u2309 &lfloor; \u230A
        &rfloor; \u230B &lang; \u2329 &rang; \u232A &loz; \u25CA
        &spades; \u2660 &clubs; \u2663 &hearts; \u2665 &diams; \u2666
        &quot; \x22 &amp; \x26 &lt; \x3C &gt; \x3E O&Elig; \u152 &oelig; \u153
        &Scaron; \u160 &scaron; \u161 &Yuml; \u178 &circ; \u2C6
        &tilde; \u2DC &ensp; \u2002 &emsp; \u2003 &thinsp; \u2009
        &zwnj; \u200C &zwj; \u200D &lrm; \u200E &rlm; \u200F &ndash; \u2013
        &mdash; \u2014 &lsquo; \u2018 &rsquo; \u2019 &sbquo; \u201A
        &ldquo; \u201C &rdquo; \u201D &bdquo; \u201E &dagger; \u2020
        &Dagger; \u2021 &permil; \u2030 &lsaquo; \u2039 &rsaquo; \u203A
        &euro; \u20AC &apos; \u0027 &lrm; ""
    };
   
    set text [string map [list "\]" "\\\]" "\[" "\\\[" "\$" "\\\$" "\\" "\\\\"] [string map $escapes $text]]
    regsub -all -- {&#([[:digit:]]{1,5});} $text {[format %c [string trimleft "\1" "0"]]} text
    regsub -all -- {&#x([[:xdigit:]]{1,4});} $text {[format %c [scan "\1" %x]]} text
    return [subst "$text"]
  }


saywhat 13 Ekim 2014 08:57

Cevap: shorten ( link kısaltma ) Tcl
 
güncelleme yapıldı. önceki yazımlarda görülen sorunlar giderildi...

( Tcl8.5.x ve üstü sürüm gerektirir. tcllib http ve htmlparse paketi gerektirir. https linkleri için tcl-tls paketi kurulmuş olması gerekir. )

Kod:

if {[info tclversion] < 8.5} {
  putloglev o * "\00312Bu scripti kullanmak icin en az, Tcl8.5.x ve ustu Tcl surumlerinden biri kurulu olmali. Algilanan surum : $tcl_patchLevel\00312"
  } else {
  putloglev o * "\00312Algilanan Tcl surumu : $tcl_patchLevel shorten.tcl yuklendi. \
  kanal ustunde aktif etmek icin :\003\00306 .chanset #kanal +shorten\003"
  }
 
package require Tcl 8.5

namespace eval isgd {
}

package require http

package require htmlparse

if {![catch {package require tls}]} {
        ::http::register https 443 [list ::tls::socket -require 0 -request 1]
        set vartls "1"
        putlog "\00304Tls algilandi, https destegi olacak.\003"
    } else {
        set vartls "0"
        putlog "\00304Tls bulunamadi. https destegi olmayacak.\003"
    }

setudef flag shorten

bind pubm - "*" ::isgd::is_gd:pubm
bind msgm - "*" ::isgd::is_gd:msgm

proc ::isgd::is_gd:msgm {nick uhost hand text} {
    ::isgd::is_gd:main $nick $uhost $hand $nick $text
    }

proc ::isgd::is_gd:pubm {nick uhost hand chan text} {
    if {![channel get $chan shorten]} { return 0 }
    ::isgd::is_gd:main $nick $uhost $hand $chan $text
    }
   
proc ::isgd::is_gd:main {nick uhost hand chan text} {
        set output [::isgd::is_gd:output $text]
        set title [::isgd::is_gd:title $text]
        set cikti ""
       
        lappend cikti \00314 {*}$output \003\00304:\003\00306 {*}[::htmlparse::mapEscapes $title] \003
    if {![info exists cikti] || [llength $output] < 1} { return }   
          puthelp "privmsg $chan :\00309$nick\003 \00304->\003[filter $cikti]"
          return 0
  }

proc ::isgd::is_gd:output {text} {
        set veri [::isgd::check_txt $text]
    if {![info exists veri] || [llength $veri] < 1} { return }       
        putlog " -> $veri"
        set isurl "http://is.gd/api.php?longurl=$veri"
       
        ::http::config -useragent "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"
        set url [::http::geturl "$isurl" -timeout [expr {6*1000}]]
        set data [split [::http::data $url] \n]
        ::http::cleanup $url
        regexp {(.*)} $data "" output
       
    if {![info exists output] || [string match -nocase "*Error*Sorry*" $output]} {
        set output "hata oluştu..."
        return $output
        } else {
        return $output
        }
}
 
proc ::isgd::is_gd:title {text} {
        set veri [::isgd::check_txt $text]
    if {![info exists veri] || [llength $veri] < 1} { return }   
        ::http::config -useragent "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"       
        set turl [::http::geturl $veri -timeout [expr {6*1000}]]
        set tdata [split [::http::data $turl] \n]
        ::http::cleanup $turl
        regexp {<title>(.*?)</title>} $tdata "" title
       
    if {![info exists title]} {
        set title "hata...bulunamadı..."
        return $title
        } else {
        return $title
        }
}
   
proc ::isgd::check_txt {text} {
        set t [stripcodes bcruag $text]
        foreach _ [split $t] {
    if {[regexp -nocase -- {(http|ftp|https|
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
out]} {
          return [lindex $out 0]
        }
    }
}   
   
proc filter {text} {
  set text [string map {"\\" "\\\\" "\[" "\\\[" "\]" "\\\]" "\{" "\\\{" "\}" "\\\}" "\$" "\\\$" "\"" "\\\""} $text]
  return [subst $text]
}


saywhat 17 Ekim 2014 08:24

Cevap: shorten ( link kısaltma ) Tcl
 
geçenlerde -> [Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] ssl 3.0 güvenlik açığı sorununun "keşf" edilmesiyle birlikte https kullanan pek çok büyük site (twitter , yahoo , paypal vs vs ..) düzenlemeye gitti..

buda bu siteler üzerinde çalışması için yazılmış/pek çok scriptte "soruna" yol açtı. (pek çok script bu sitelere bağlantı isteğine yanıt alamadığından, sock hatası atıp, işlemez hale geldi)

yukarıdaki paylaştığım script içinde :

Kod:

::http::register https 443 [list ::tls::socket -require 0 -request 1]
satırını :

Kod:

tls::init -tls1 1
::http::register https 443 tls::socket

olarak değişmeniz halinde bu tür siteler için bağlantı , bilgi alımı yeniden mümkün olacaktır...

(bu tür siteler için yazılmış kullandığınız scriptler var ise "tls desteğiyle işleyen", (yaklaşık 3 gündür çalışmıyor olmalılar) onlarıda bu şekilde "onarmanız,yeniden işler hale getirmeniz mümkün olacaktır....)


Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 15:35.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2025 IRCForumlari.Net Sparhawk