Mise en forme de code: pensez à utiliser les balises [ tcl ] et [ /tcl ] (sans les espaces bien sûr) autour de vos codes tcl afin d'avoir un meilleur rendu et une coloration syntaxique. x


youtube script
#16
11:06:52am / * <iRoc> http://youtu.be/YIBo4yvLkfU
11:06:53am / * <iB0T> Raanjhanaa - Title Track ft. Dhanush & Sonam Kapoor - YouTube' ( 2 minutes 22 seconds ) Viewed 1.018.908
11:06:57am / * <iRoc> http://www.youtube.com/watch?v=69HNy2r7f-M
11:06:58am / * <iB0T> Let's Battle Minecraft S4 #3 [Battlemap/HD/German] - Geht weg :( - YouTube' ( 16 minutes 28 seconds ) Viewed 5.372




tcl
package require http 2.4
bind PUBM - * mu
proc mu {nick uhost hand chan text} {
	set web(page) http://www.youtube.com
	set watch [regexp -nocase -- {\/watch\?v\=([^\s]{11})} $text youtubeid]
	if { $watch == 0 } {
		set watch [regexp -nocase -- {youtu\.be\/([^\s]{11})} $text a youtubeid]
		if { $watch == 0 } return
		set youtubeid "/watch?v=$youtubeid"
	}
 
	set logoo "\002\00301,00You\00300,04Tube\002\017"
 
	if {$watch && $youtubeid != ""} {
		putlog "$web(page)$youtubeid"
		set agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"     
		set t [::http::config -useragent $agent]
		set t [::http::geturl "$web(page)$youtubeid" -timeout 30000]
		set data [::http::data $t]
		::http::cleanup $t
 
		set l [regexp -all -inline -- {<title>(.*?)</title>.*?<span class="watch-view-count " >(.*?)</span>} $data]
 
		regexp {"length_seconds": (\d+),} $data "" length
 
		foreach {black a b c d e} $l {
 
			set a [string map -nocase {\&\#39; \x27 &amp; \x26 &quot; \x22} $a]
			set b [string map [list \n ""] $b]
			set c [string map [list \n ""] $c]
			set d [string map [list \n ""] $d]
			set e [string map -nocase {\&\#39; \x27 &amp; \x26 &quot; \x22} $e]
 
			regsub -all {<.*?>} $a {} a
			regsub -all {<.*?>} $b {} b
			regsub -all {<.*?>} $c {} c
			regsub -all {<.*?>} $d {} d
			regsub -all {<.*?>} $e {} e			
 
			putserv "PRIVMSG $chan :$a' ( [duration $length] ) Viewed $b"
 
			    proc duration {s} {
				variable etube
				set hours [expr {$s / 3600}]
				set minutes [expr {($s / 60) % 60}]
				set seconds [expr {$s % 60}]
				set res ""
 
				if {$hours != 0} {append res "$hours hours"}				
				if {$minutes != 0} {append res " $minutes minutes"}
				if {$seconds != 0} {append res " $seconds seconds"}
				return $res
 
			}	
		}
	}
}



Messages In This Thread
youtube script - by zyrte - 13/09/2011, 15:28
RE: youtube script - by aliasangelius - 13/09/2011, 15:51
RE: youtube script - by zyrte - 13/09/2011, 16:03
RE: youtube script - by aliasangelius - 13/09/2011, 17:16
RE: youtube script - by zyrte - 13/09/2011, 17:24
RE: youtube script - by aliasangelius - 13/09/2011, 17:26
RE: youtube script - by zyrte - 13/09/2011, 17:31
RE: youtube script - by Cain - 16/09/2011, 18:57
RE: youtube script - by aliasangelius - 17/09/2011, 10:37
RE: youtube script - by Cain - 17/09/2011, 13:31
RE: youtube script - by CrazyCat - 16/05/2012, 09:44
RE: youtube script - by EvilHeart - 19/05/2013, 11:48
RE: youtube script - by aliasangelius - 25/05/2012, 10:26
RE: youtube script - by Hitsu - 27/03/2013, 18:10
RE: youtube script - by aliasangelius - 28/05/2013, 21:12
RE: youtube script - by EvilHeart - 29/05/2013, 07:10
RE: youtube script - by aliasangelius - 29/05/2013, 15:16
RE: youtube script - by Hitsu - 16/07/2013, 10:03
RE: youtube script - by CrazyCat - 16/07/2013, 10:24
RE: youtube script - by Hitsu - 16/07/2013, 10:37
RE: youtube script - by taboune - 26/08/2013, 18:44
RE: youtube script - by JazZ - 18/02/2014, 15:24
RE: youtube script - by Furaxx37 - 29/04/2014, 10:32
RE: youtube script - by CrazyCat - 27/05/2014, 13:32
RE: youtube script - by Oz- - 18/01/2016, 10:15
RE: youtube script - by CrazyCat - 18/01/2016, 10:29
RE: youtube script - by Oz- - 18/01/2016, 11:00
RE: youtube script - by CrazyCat - 18/01/2016, 11:12
RE: youtube script - by Oz- - 18/01/2016, 11:26
RE: youtube script - by Oz- - 18/01/2016, 12:34
RE: youtube script - by MisterS - 18/01/2016, 17:15
RE: youtube script - by MisterS - 18/01/2016, 17:17

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Résolu]Youtube-link bouba89 9 1,002 27/05/2021, 16:41
Last Post: ZarTek
  Youtube pheeric 19 7,692 17/08/2020, 22:34
Last Post: pheeric
  [Résolu] Youtube pheeric 1 1,860 11/01/2020, 00:10
Last Post: pheeric
Smile Youtube.tcl par aliasangelius pheeric 8 6,740 02/01/2018, 17:25
Last Post: cestlemien
  [Résolu] Youtube tcl (Zurl.tcl) ne fonctionne plus Krypte 23 14,347 28/04/2017, 18:22
Last Post: Alucard`68
  erreur script youtube zyrte 17 13,194 18/11/2012, 11:31
Last Post: CrazyCat

Forum Jump:


Users browsing this thread: 1 Guest(s)