#UPDFinder on
on *:LOAD:{
if ($version < 7.14) echo -a 4PS3UPDFinder v1.00 Build 02 (Written By Wims) Requires mIRC v7.14 or newer to be installed successfully, script auto-unloaded.
else echo -a 3PS3UPDFinder v1.00 Build 02 (Written By Wims), Successfully loaded.
}
on *:UNLOAD:echo -a 4PS3UPDFinder v1.00 Build 02 (Written By Wims), Successfully unloaded.
alias Game_id {
;create the socket connection
sockclose game_id
sockopen game_id yifan.lu 80
inc %guds
sockmark game_id $1-
}
on *:sockopen:game_id:{
; request the correct page
if ($sockerr) { if ($hget(game_id)) hfree game_id | return }
sockwrite -n $sockname GET $+(/psn/?titleid=,$urlencode($gettok($sock($sockname).mark,3,32)),&env=np) HTTP/1.0
sockwrite -n $sockname Host: yifan.lu
sockwrite -n $sockname
sockmark $sockname $gettok($sock($sockname).mark,1-2,32)
}
on *:sockread:game_id:{
if ($sockerr) { if ($hget(game_id)) hfree game_id | return }
var %a,%c $gettok($sock($sockname).mark,1,44),%g,%d,%e 1
sockread %a
while ($sockbr) {
;if we have a line of information
if (<tr><td><strong>* iswm %a) {
;this regex does all the parsing job
noop $regex(parse,$nohtml(%a),/^(\d+(?:\.\d+)?)(.+\.pkg)(\d+) Bytes(.{40})(\d+(?:\.\d+)?|)(?:Game:(.+)(?:« Back)?)?/iS)
;remove the crap around the game's name (if there's a game's name)
var %g = $regsubex($html2ascii($regml(parse,6)),/[^- :&[:alnum:]]/g,)
;temp variable just to get the output and we store it into an hash table for later
%d = UPD Version: $regml(parse,1) - DOWNLOAD: $regml(parse,2) - File Size: $bytes($regml(parse,3),M3d).suf $iif($regml(parse,5),- FW Version: $iif($v1 >= 3.6,$+($chr(3),04,$v1),$v1))
hadd -m temp $calc($hget(temp,0).item + 1) %d
;if there's a game name, get every line and send them slowly with a timer, we are also handling the queue here, if the line is the last one, we go on with the next request
if (%g) {
%c Game: %g
while ($hget(temp,%e)) { .timer 1 $calc(2*%e) $safe(%c $v1) $iif(%e == $hget(temp,0).item,$(|) queue) | inc %e }
sockclose $sockname
hfree temp
return
}
}
elseif (*Invalid title id or cannot find game* iswm %a) {
%c Invalid title id
sockclose $sockname
queue
return
}
sockread -f %a
}
}
alias queue {
if ($hget(game_id,counter) <= $calc($hget(game_id,0).item - 1)) {
.timer -h 1 0 game_id $safe($hget(game_id,$hget(game_id,counter)))
hinc game_id counter
}
else hfree game_id
}
alias -l safe bset -ct &a 1 $1 | return $!utfdecode($regsubex(safe, $bvar(&a,1-) ,/(\d+)(?: |$)/g,$chr(\1)))
alias -l urlencode return $regsubex($$1,/([\W\s])/Sg,$+(%,$base($asc(\t),10,16,2)))
alias -l nohtml return $regsubex($1,/<[^>]+(?:>|$)|^[^<>]+>/g,)
alias -l HT2AS {
var %A quot amp lt gt nbsp iexcl cent pound curren yen brvbar sect uml copy ordf $&
laquo not shy reg macr deg plusmn sup2 sup3 acute micro para middot cedil sup1 $&
ordm raquo frac14 frac12 frac34 iquest Agrave Aacute Acirc Atilde Auml Aring AElig $&
Ccedil Egrave Eacute Ecirc Euml Igrave Iacute Icirc Iuml ETH Ntilde Ograve Oacute $&
Ocirc Otilde Ouml times Oslash Ugrave Uacute Ucirc Uuml Yacute THORN szlig agrave $&
aacute acirc atilde auml aring aelig ccedil egrave eacute ecirc euml igrave iacute $&
icirc iuml eth ntilde ograve oacute ocirc otilde ouml divide oslash ugrave uacute $&
ucirc uuml yacute thorn yuml trade
var %B 34 38 60 62 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 $&
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 $&
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 $&
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 $&
243 244 245 246 247 248 249 250 251 252 253 254 255 153
return $chr($gettok(%B,$findtokcs(%a,$1,32),32))
}
alias -l html2ascii {
var %r /&(.{2,6});/Ug
return $regsubex($1-,%r, $iif(#* iswm \t, $chr($mid(\t,2) ), $HT2AS(\t) ))
}
on *:text:?gameupdates:#chan:msg $chan There has been %guds Total Game Updates Searched...
on *:text:!gameupdate*:#chan:{
if ($1 == !gameupdate) {
var %c notice $nick
if (!$2) %c Invalid cmd, try again with !gameupdate <GameID> .
elseif ($hget(game_id)) hadd game_id $hget(game_id,0).item %c $upper($2)
else { hadd -m game_id counter 1 | game_id %c $upper($2) }
}
}
#UPDFinder end
Menu menubar,status,channel {
.$iif($group(#UPDFinder) == on,$style(1)) PS3 UPDFinder
..$iif($group(#UPDFinder).status == on,$style(2)) Enable:/.enable #UPDFinder | echo -a ->-14[3UPDFinder3 Script have been Enabled14].
..$iif($group(#UPDFinder).status == off,$style(2)) Disable:/.disable #UPDFinder | echo -a ->-14[4UPDFinder3 Script have been Disabled14].
}