Here is the Script
Code: Select all
bind PUB -|- ".charts" pub:mtv:charts
setudef flag charts
proc pub:mtv:charts { nickname hostname handle channel arguments } {
	if { [info exists ::chartsdone($channel)] || ![channel get $channel charts] } {
		return 0
	}
	package require http
	set x [http::config -useragent "Mozilla"]
	set x [http::geturl "http://www.mtv.de/hitlistgermany/index.php" -timeout 2000]
	set y [http::data $x]
	http::cleanup $x
	unset x
	set   chartcurrent  0
	set   chartlist     ""
	foreach element [split $y \n] {
		if { ![info exists preline] } {
			if { [regexp {width=\"160\"} $element chartline] } {
				set  preline       1
	
				regsub -all -- {\<(.*?)>} $element "" element
				append chartlist "$element "
				continue
			}
		}
		if { [info exists preline] } {
			if { [regexp {width=\"163\"} $element chartline] } {
				unset preline
				incr chartcurrent
				regsub -all -- {\<(.*?)>} $element "" element
				append chartlist "- $element|"
				if { $chartcurrent == 5 } {
					break
				}
				continue
			}
		}
	}
	set x 1
	foreach chart [split $chartlist "|"] {
		if { $chart != "" } {
			lappend charts "\002$x.\002 $chart"
			incr x
			continue
		}
	}
	sendmsg $channel "GERMAN TOP5" "[join $charts " | "]"
	set ::chartsdone($channel) 1
	utimer 10 [list unset ::chartsdone($channel)]
}
Regards LKTcl error [pub:mtv:charts]: can't read "chart": no such variable
edit: solved the Prob. Found my glasses

another question. At the moment the output is like that
But i would like to have it this way« GERMAN TOP5 » «1. Herbert Groenemeyer - Lied 1- Stueck Vom Himmel | 2. Nelly Furtado - All Good Things (Come To An End) | 3. DJ Oetzi & Nik P - Ein Stern (der Deinen Namen..) | 4. Ville Valo & Natalia Avelon - Summer Wine | 5. Hoehner - Wenn Nicht Jetzt Wann Dann? »
Cant get it solved with \n]« GERMAN TOP5 » «1. Herbert Groenemeyer - Lied 1- Stueck Vom Himmel
2. Nelly Furtado - All Good Things (Come To An End)
3. DJ Oetzi & Nik P - Ein Stern (der Deinen Namen..)
4. Ville Valo & Natalia Avelon - Summer Wine
5. Hoehner - Wenn Nicht Jetzt Wann Dann? »
