<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/20657" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2019-09-11T11:38:34-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/20657</id>

		<entry>
		<author><name><![CDATA[Stefano1990]]></name></author>
		<updated>2019-09-11T11:38:34-04:00</updated>

		<published>2019-09-11T11:38:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107819#p107819</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107819#p107819"/>
		<title type="html"><![CDATA[Hello]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107819#p107819"><![CDATA[
This grabber urltitle have bug , is not work with HTTPS only HTTP<br><br>Connection to <a href="http://www.youtube.com/watch?v=t1RTgznup5c" class="postlink">http://www.youtube.com/watch?v=t1RTgznup5c</a> failed<br>Error: Unsupported URL type "https"<br><br>if anyone can fixed thx in advance<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12745">Stefano1990</a> — Wed Sep 11, 2019 11:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[BarGuy]]></name></author>
		<updated>2019-08-20T20:57:33-04:00</updated>

		<published>2019-08-20T20:57:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=107757#p107757</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=107757#p107757"/>
		<title type="html"><![CDATA[HTML Codes In URL Grabber]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=107757#p107757"><![CDATA[
So Im running the script urltitle 0.11 and I get the following at times with a url is posted:<br><a href="https://twitter.com/_faizann/status/1157157933223821317" class="postlink">https://twitter.com/_faizann/status/1157157933223821317</a><br>Title: faiz on Twitter: "texted my number neighbor....safe to say i got a new best friend… "<br><br>I and REALLY new to eggdrop and ubuntu as well (just started last weekend). I read on another threat about adding something along the lines of "$quot;" " " to a string map line to replace the html code with a space, but this particular script doesn't contain a string map. Can someone help me out with tweaking this script to either remove the html code or make it work properly when it sees an html code. Below is the script Im running .<div class="codebox"><p>Code: </p><pre><code># Script to grab titles from webpages# Updated version by teel @ IRCnet## https://github.com/teeli/urltitle## Detects URL from IRC channels and prints out the title## Version Log:# 0.11     Updated regex parser to only parse titles inside &lt;head&gt; tags#          Added HTTP error status logging# 0.10     Fixed XPath parsing error and added regex fallback if XPath fails# 0.09     HTTPs redirects, case-insensitive HTTP header fix, other small bug fixes# 0.08     Changed putserv to puthelp to queue the messages# 0.07     Added Content-Type check (text/html only) and exceptino handling for tDom with a fallback to#          regexp if tDom fails.# 0.06     Added XPATH support to title parsing (only if tdom package is available)# 0.05     Added SNI support for TLS (with TLS version check)# 0.04     HTML parsing for titles added# 0.03c    HTTPS support is now optional and will be automatically dropeed if TCL TSL package does not exist# 0.03b    Some formatting# 0.03     HTTPS support# 0.02     Updated version by teel. Added support for redirects, trimmed titles (remove extra whitespaces),#          some optimization# 0.01a    Original version by rosc################################################################################################################### Original script:# Copyright C.Leonhardt (rosc2112 at yahoo com) Aug.11.2007# http://members.dandy.net/~fbn/urltitle.tcl.txt# Loosely based on the tinyurl script by Jer and other bits and pieces of my own..################################################################################################################### Usage:## 1) Set the configs below# 2) .chanset #channelname +urltitle        ;# enable script# 3) .chanset #channelname +logurltitle     ;# enable logging# Then just input a url in channel and the script will retrieve the title from the corresponding page.#################################################################################################################namespace eval UrlTitle {  # CONFIG  variable ignore "bdkqr|dkqr" ;# User flags script will ignore input from  variable length 5            ;# minimum url length to trigger channel eggdrop use  variable delay 1             ;# minimum seconds to wait before another eggdrop use  variable timeout 5000        ;# geturl timeout (1/1000ths of a second)  variable fetchLimit 5        ;# How many times to process redirects before erroring  # BINDS  bind pubm "-|-" {*://*} UrlTitle::handler  setudef flag urltitle        ;# Channel flag to enable script.  setudef flag logurltitle     ;# Channel flag to enable logging of script.  # INTERNAL  variable last 1              ;# Internal variable, stores time of last eggdrop use, don't change..  variable scriptVersion 0.11  # PACKAGES  package require http         ;# You need the http package..  variable httpsSupport false  variable htmlSupport false  variable tdomSupport false  if {![catch {variable tlsVersion [package require tls]}]} {    set httpsSupport true    if {[package vcompare $tlsVersion 1.6.4] &lt; 0} {      putlog "UrlTitle: TCL TLS version 1.6.4 or newer is required for proper https support (SNI)"    }  }  if {![catch {package require htmlparse}]} {    set htmlSupport true  }  if {![catch {package require tdom}]} {    set tdomSupport true  }  # Enable SNI support for TLS if suitable TLS version is installed  proc socket {args} {    variable tlsVersion    set opts [lrange $args 0 end-2]    set host [lindex $args end-1]    set port [lindex $args end]    if {[package vcompare $tlsVersion 1.7.11] &gt;= 0} {      # tls version 1.7.11 should support autoservername      ::tls::socket -autoservername true {*}$opts $host $port    } elseif {[package vcompare $tlsVersion 1.6.4] &gt;= 0} {      ::tls::socket -ssl3 false -ssl2 false -tls1 true -servername $host {*}$opts $host $port    } else {      # default fallback without servername (SNI certs will not work)      ::tls::socket -ssl3 false -ssl2 false -tls1 true {*}$opts $host $port    }  }  proc handler {nick host user chan text} {    variable httpsSupport    variable htmlSupport    variable delay    variable last    variable ignore    variable length    set unixtime [clock seconds]    if {[channel get $chan urltitle] &amp;&amp; ($unixtime - $delay) &gt; $last &amp;&amp; (![matchattr $user $ignore])} {      foreach word [split $text] {        if {[string length $word] &gt;= $length &amp;&amp; [regexp {^(f|ht)tp(s|)://} $word] &amp;&amp; \            ![regexp {://([^/:]*:([^/]*@|\d+(/|$))|.*/\.)} $word]} {          set last $unixtime          # enable https if supported          if {$httpsSupport} {            ::http::register https 443 [list UrlTitle::socket]          }          set urtitle [UrlTitle::parse $word]          if {$htmlSupport} {            set urtitle [::htmlparse::mapEscapes $urtitle]          }          # unregister https if supported          if {$httpsSupport} {            ::http::unregister https          }          if {$urtitle eq ""} {            break          }          if {[string length $urtitle]} {            puthelp "PRIVMSG $chan :Title: $urtitle"          }          break        }      }    }    # change to return 0 if you want the pubm trigger logged additionally..    return 1  }  # General HTTP redirect handler  proc Fetch {url args} {    variable fetchLimit    for {set count 0} {$count &lt; $fetchLimit} {incr count} {      set token [::http::geturl $url {*}$args]      if {[::http::status $token] ne "ok" || ![string match 3?? [::http::ncode $token]]} {        break      }      set meta [::http::meta $token]      if {[dict exists $meta Location]} {        set url [dict get $meta Location]      }      if {[dict exists $meta location]} {        set url [dict get $meta location]      }      ::http::cleanup $token    }    return $token  }  proc parseTitleXPath {data} {    set title ""    if {[catch {set doc [dom parse -html -simple $data]} results]} {      # fallback to regex parsing if tdom fails      set title [parseTitleRegex $data]    } else {      # parse dom      set root [$doc documentElement]      set node [$root selectNodes {//head/title/text()}]      if {$node != ""} {        # return title if XPath was able to parse it        set title [$node data]      } else {        # Fallback to regex if XPath failed        set title [parseTitleRegex $data]      }    }  }  proc parseTitleRegex {data} {    set title ""    # fallback to regex parsing if tdom fails    regexp -nocase {&lt;head&gt;.*&lt;title.*&gt;(.*?)&lt;/title&gt;.*&lt;/head&gt;} $data match title    set title [regsub -all -nocase {\s+} $title " "]    return $title  }  proc parse {url} {    variable timeout    variable tdomSupport    set title ""    if {[info exists url] &amp;&amp; [string length $url]} {      if {[catch {set http [Fetch $url -timeout $timeout]} results]} {        putlog "Connection to $url failed"        putlog "Error: $results"      } else {        if { [::http::status $http] == "ok" } {          set data [::http::data $http]          set status [::http::code $http]          set meta [::http::meta $http]          # only parse html files for titles          if {            ([dict exists $meta Content-Type] &amp;&amp; [string first "text/html" [dict get $meta Content-Type]] &gt;= 0) ||            ([dict exists $meta content-type] &amp;&amp; [string first "text/html" [dict get $meta content-type]] &gt;= 0)          } {            switch -regexp -- $status {              "HTTP.*200.*" {                if {$tdomSupport} {                  # use XPATH if tdom is supported                  set title [parseTitleXPath $data]                } else {                  # fallback to regex parsing if tdom is not enabled                  set title [parseTitleRegex $data]                }              }              "HTTP\/[0-1]\.[0-1].3.*" {                if {[dict exists $meta Location]} {                  set title [UrlTitle::parse [dict get $meta Location]]                }                if {[dict exists $meta location]} {                  set title [UrlTitle::parse [dict get $meta location]]                }              }              default {                putlog "Error: $status ($url)"              }            }          }        } else {          putlog "Connection to $url failed"        }        ::http::cleanup $http      }    }    return $title  }  putlog "Initialized Url Title Grabber v$scriptVersion"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12815">BarGuy</a> — Tue Aug 20, 2019 8:57 pm</p><hr />
]]></content>
	</entry>
	</feed>
