mIRC Home    About    Download    Register    News    Help

Page 1 of 2 1 2 >
Topic Options
#239985 - 13/12/12 08:45 PM Calling info from a URL ,a little help please
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Hi guys, I've been using a script that was made for me a while ago that calls a website and checks for a game update, if it is found (or not) the results are returned back into the channel on iRC. The problem is I am no longer in contact with the maker of the script and the site it called for the updates from is no longer up.

I was wondering how hard it is to edit his script and have it point to a new URL to get the updates from or is it better to just get the script re-written? I tried to edit it myself and failed as expected as I just have no clue what I'm meant to edit. I've pasted his script below for anyone that wants to take a look for me ,TIA wink

New URL to point the script to for the update info:

http://yifan.lu/psn/

Sorce code for the NEW webpage I want to pull the updates from (not sure if it is needed):

http://yifan.lu/p/psn_update_finder/

UPDFinder script below:

Click to reveal..
Code:
#UpdFinder on
on *:load:{
  echo -a 15Loading Variables stand by...
  set %gidlock  unlocked
  set %gis 0
  echo -a 15Variables Successfully 3Loaded,enjoy...
}
on *:text:!gameupdate:#MY_CHANNEL:{
  notice $nick 15Y0 sup my man, try !gameupdate <4GameID15> .
  }
on *:text:??gameupdates:#MY_CHANNEL:{
msg $chan 15There has been3 %gis 15Total Game Updates Searched... }
on *:text:!gameupdate *:#MY_CHANNEL:{
  inc %gis
  if (%gidlock = locked) { notice $nick 15Just warming up ,hit me back up again in about4 515 sec's. }
  if (%gidlock = unlocked) {
    set %gidlock locked
    set %gid $upper($2)
    set %gidnick $nick
    notice %gidnick 15Searching game updates for4 %gid
    psnupdate
  }
}
alias psnupdate {
  remove psnupdate
  sockopen psnupdate s4bres-world.com 80
}
on *:sockopen:psnupdate:{
  if !$sockerr {
    var %status sockwrite -tn psnupdate
    %status GET /psn_update_finder.php?titleid= $+ %gid $+ &env=np  HTTP/1.1
    %status $sockname Accept: *.*, */* 
    %status HOST: www.s4bres-world.com
    %status Connection: close
    %status $crlf
  }
}
on *:sockread:psnupdate:{
  if ($sockerr > 0) {
    return
  }
  sockread %temp
  if ($sockbr == 0) {
    return
  }
  if (%temp == $null) {
    %temp = -
  }
  if (%temp == </html>) {
    testxc2
    sockclose %text
  }
  if (Invalid isin %temp) { notice %gidnick 4Invalid GameID,No Update Available or you just dont have enough 3shinnizle15....No Results found matching:4 %gid | set %gidlock unlocked | halt }
  if (strong isin %temp) {
    write psnupdate %temp *
  }
  if (<em> isin %temp) {
    parse
  }
}
alias parse2 {
  parse
}
alias parse {
  set %parselines $lines(psnupdate)
  if ($lines(psnupdate) = 1) {
    notice %gidnick 15Prasing Error - 15Try !gameupdate3 %gid 15again
    set %gidlock unlocked
    halt
  }
  if (Acirc isin $read(psnupdate, %parselines )) {
    /notice %gidnick 15 $gettok($gettok($gettok($gettok($read(psnupdate, %parselines ),6,60),2,62),2-4,59),1,38) $gettok($gettok($gettok($gettok($read(psnupdate, %parselines ),6,60),2,62),2-4,59),3,59) 14-3 %gid
    goto againparse2
  }
  if (</tbody></table><br isin $read(psnupdate, %parselines )) {
    notice %gidnick 15 $gettok($gettok($gettok($read(psnupdate, %parselines ),6,60),2,62),2,59) 14-3 %gid
  }
  else { notice %gidnick 15 $gettok($gettok($gettok($read(psnupdate, %parselines ),4,62),1,60),2,59) 14-3 %gid
  }
  :againparse2
  set %parseln 1
  :againparse
  if (back isin  $read(psnupdate, %parseln )) {
    set %gidlock unlocked
    halt
  }
  if (%parseln > %parselines) {
    set %gidlock unlocked
    halt
  }
  else {
    if ($gettok($gettok($read(psnupdate, %parseln ),14,60),2,62) > 3.55) {  notice %gidnick 15Update Version:8 $gettok($gettok($read(psnupdate, %parseln ),3,60),2,62) 15URL: $gettok($read(psnupdate, %parseln  ),2,34) 15File Size:4 $gettok($gettok($read(psnupdate, %parseln ),10,60),2,62) 15FW Version:8/4!8\4 $gettok($gettok($read(psnupdate, %parseln ),14,60),2,62) 8/4!8\ }
    else { notice %gidnick 15Update Version:8 $gettok($gettok($read(psnupdate, %parseln ),3,60),2,62) 15URL: $gettok($read(psnupdate, %parseln  ),2,34) 15File Size:4 $gettok($gettok($read(psnupdate, %parseln ),10,60),2,62) 15FW Version:3 $gettok($gettok($read(psnupdate, %parseln ),14,60),2,62) }
    inc %parseln
    goto againparse
  }
}
on *:sockclose:text:{
  //echo -a Sock CLosed
}
#UpdFinder end
Menu menubar,status,channel {
  .$iif($group(#UpdFinder) == On,$style(1)) UpdFinder
  ..$iif($group(#UpdFinder).status == on,$style(2)) Enable:/.enable #UpdFinder | notice $nick 14[3PS3 UpdFinder have been Enabled14].
  ..$iif($group(#UpdFinder).status == off,$style(2)) Disable:/.disable #UpdFinder | notice $nick 14[4PS3 UpdFinder have been Disabled14].
}



If anyone can take a look that would be great ,again TIA

D00M

Top
#239986 - 13/12/12 10:33 PM Re: Calling info from a URL ,a little help please [Re: D00M]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
This part is where you make the connection. You want the hostname here (change s4bres-world.com . Do not include www.). For your site, you'd change it to: yifan.lu
Code:
alias psnupdate {
  remove psnupdate
  sockopen psnupdate s4bres-world.com 80
}


This is where you choose the location of the page you want to retrieve. Basically, it's just the rest of the URL. So you need to change the /psn_update_finder.php?titleid= $+ %gid $+ &env=np part to match the URL. Note that $+ %gid $+ means to put the value of %gid in that place without spacing around it. For your site, you'd change it to: /psn/?titleid= $+ %gid $+ &env=np
Code:
on *:sockopen:psnupdate:{
  if !$sockerr {
    var %status sockwrite -tn psnupdate
    %status GET /psn_update_finder.php?titleid= $+ %gid $+ &env=np  HTTP/1.1
    %status $sockname Accept: *.*, */* 
    %status HOST: www.s4bres-world.com
    %status Connection: close
    %status $crlf
  }
}


The sockread event and parse alias also may need updated (I haven't looked to find out). Basically, both of those are how you parse the page. You want to look at the HTML of the page and find the results you are looking for. For example, it checks to see if "Invalid" is in the line and if so, it gives you an error message. Now, the existing parsing looks really convoluted and probably could have been done much more cleanly. Normally, you can just look for the lines thave have the information you need and use a unique value only found on those lines and check for that to do what you want. I don't know what to search for on the site to see what the page's HTML looks like, but it's probably fairly basic.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#239990 - 14/12/12 05:35 AM Re: Calling info from a URL ,a little help please [Re: Riamus2]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Hey Riamus2 ,thanks for the reply. I did try what you suggested actually before I came here but I would always received a parsing error.

Code:
alias psnupdate {
  remove psnupdate
  sockopen psnupdate yifan.lu 80
}
on *:sockopen:psnupdate:{
  if !$sockerr {
    var %status sockwrite -tn psnupdate
    %status GET /psn/?titleid= $+ %gid $+ &env=np  HTTP/1.1
    %status $sockname Accept: *.*, */* 
    %status HOST: yifan.lu
    %status Connection: close
    %status $crlf
  }
}


status window error:
Code:
覧覧覧覧覧覧覧覧覧覧
* Removed 'D:\ProgramFiles\mIRC\psnupdate'
覧覧覧覧覧覧覧覧覧覧
[3:21pm] -> -D00M- Parsing Error - Try !gameupdate BLES00987 again
覧覧覧覧覧覧覧覧覧覧
* /sockclose: insufficient parameters (line 51, UPDFinder.mrc)
覧覧覧覧覧覧覧覧覧覧
[3:21pm] ERROR > 421: Unknown command: TESTXC2


Line 51:
Code:
    sockclose %text


Code:
[3:25pm] <@D00M> !gameupdate bles009
[3:25pm] *UPDBot* Searching game updates for BLES009
[3:25pm] *UPDBot* Invalid GameID,No Update Available or you just don't have enough shinnizle....No Results found matching: BLES009


As far as I can tell the last part seems to be working for invaild gameid. The cmd is

!gameupdate BLES00987

The "BLES00987" is a gameid and is what you would enter on his website. If I put an invalid gameid, it returns correctly (afaik). If I have a valid gameid, which should return results ,it errors with the above. I figured I had the edit right but just couldn't get it to return a valid result.


EDIT: ok for what ever reason it seems to be certin gameids it just doesnt like. I tried a different id and I got the results back as it should.

Click to reveal..
Code:
[4:13pm] <@D00M> !gameupdate blus30061
[4:13pm] *UPDBot* Searching game updates for BLUS30061
[4:13pm] *UPDBot*  - BLUS30061
[4:13pm] *UPDBot* Update Version: 01.30 URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLUS30061/BLUS30061_T11/3a0d66c70319b5d9/UP0006-BLUS30061_00-BURNOUTPATCH0003-A0130-V0100-PE.pkg File Size: 402842736 Bytes FW Version: 02.2000
[4:13pm] *UPDBot* Update Version: 01.40 URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLUS30061/BLUS30061_T11/3a0d66c70319b5d9/UP0006-BLUS30061_00-BURNOUTPATCH0004-A0140-V0100-PE.pkg File Size: 161177936 Bytes FW Version: 02.2000
[4:13pm] *UPDBot* Update Version: 01.50 URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLUS30061/BLUS30061_T11/3a0d66c70319b5d9/UP0006-BLUS30061_00-BURNOUTPATCH0005-A0150-V0101-PE.pkg File Size: 36593312 Bytes FW Version: 02.4000
[4:13pm] *UPDBot* Update Version: 01.60 URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLUS30061/BLUS30061_T11/3a0d66c70319b5d9/UP0006-BLUS30061_00-BURNOUTPATCH0006-A0160-V0100-PE.pkg File Size: 261525776 Bytes FW Version: 02.4000
[4:13pm] *UPDBot* Update Version: 01.70 URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLUS30061/BLUS30061_T11/3a0d66c70319b5d9/UP0006-BLUS30061_00-BURNOUTPATCH0007-A0170-V0100-PE.pkg File Size: 139441360 Bytes FW Version: 02.4000
[4:13pm] *UPDBot* Update Version: 01.80 URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLUS30061/BLUS30061_T11/3a0d66c70319b5d9/UP0006-BLUS30061_00-BURNOUTPATCH0008-A0180-V0100-PE.pkg File Size: 183983360 Bytes FW Version: 02.4000]


I still get the error in the status window
Code:
* /sockclose: insufficient parameters (line 51, UPDFinder.mrc)
覧覧覧覧覧覧覧覧覧覧
[4:13pm] ERROR > 421: Unknown command: TESTXC2


Would it be better to just cut the middle man so to speak (if it's even possible) and have the script pull the results from the source instead of yifan.lu or just try to get the script to work with yifan.lu as the middle man?

I'm just thinking ahead as if yifan goes down I will be back in the same boat and I'm not sure if it is the site itself that is causing the errors or the script as the script worked nicely for the most part on the old site.

Why is it returning results for some and not others?
Any help would be great wink


Edited by D00M (14/12/12 06:43 AM)

Top
#239991 - 14/12/12 07:35 AM Re: Calling info from a URL ,a little help please [Re: D00M]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
I must inform you that the script you were using was one of the worst I have ever seen, so I decided to rewrite it entirely:

Code:
alias Game_id {
  sockclose game_id
  sockopen game_id yifan.lu 80
  sockmark game_id $1-
}
on *:sockopen:game_id:{ 
  sockwrite -n $sockname GET $+(/psn/?titleid=,$urlencode($gettok($sock(game_id).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:{
  var %a,%c $sock($sockname).mark
  sockread -f %a
  while ($sockbr) {
    if (<tr><td><strong>* iswm %a) {
      noop $regex(parse,$nohtml(%a),/^(\d+(?:\.\d+)?)(.+\.pkg)(\d+) Bytes(.{40})(\d+(?:\.\d+)?)(?:Game:(.+)&laquo; Back)?/iS)
      %c Version: $regml(parse,1) - Url: $regml(parse,2) - Size: $regml(parse,3) - Checksum (sha1): $regml(parse,4) - Ps3 Min Version: $regml(parse,5)
      if ($regml(parse,6)) %c Game: $html2ascii($v1)
    }
    elseif (*Invalid title id or cannot find game* iswm %a) {
      %c Invalid title id
      sockclose $sockname
      return
    }
    sockread -f %a
  }
}
alias urlencode return $regsubex($$1,/([\W\s])/Sg,$+(%,$base($asc(\t),10,16,2)))
alias nohtml return $regsubex($1,/<[^>]+(?:>|$)|^[^<>]+>/g,)
alias 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 html2ascii {
  var %r /&(.{2,6});/Ug
  return $regsubex($1-,%r, $iif(#* iswm \t, $chr($mid(\t,2) ), $HT2AS(\t) ))
}

on *:text:!gameupdate &:#channel:{
  if (!$sock(game_id)) game_id notice $nick $upper($2)
}
It's simpler than before, there's no message when the bot is busy with one request (but it won't start a second one until the current one is done), there's no more a count of people who have searched something etc, it's just !gameupdate <ID> and either you get some notices with the info, or you get an error in notice, it's nicely done so adding back those things can be done with ease.


Edited by Wims (14/12/12 10:51 AM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#239992 - 14/12/12 08:07 AM Re: Calling info from a URL ,a little help please [Re: Wims]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Hey Wims ,the script was made a long time ago for me so I cant comment on how bad it is I just know that for the most part it did work lol.

I tried your script and it did return info but the info was blank.

Code:
[6:25pm] <@D00M> !gameupdate blus30061
[6:26pm] *UPDBot* Version:
[6:26pm] *UPDBot* Url:
[6:26pm] *UPDBot* Size:
[6:26pm] *UPDBot* Checksum (sha1):
[6:26pm] *UPDBot* Ps3 Min Version:
[6:26pm] *UPDBot* Game:


For some reason it didn't return the results but I do like how you have it set out. The only thing with that is if it returns many updates (sometimes up to 15 can be found) that might get a little much for a notice ,maybe a msg will be better if say the results are over 5 or just send it as a msg period.

Quote:
there's no message when the bot is busy with one request (but it won't start a second one until the current one is done),


The problem with that is users in the channel will most likely spam the trigger as they will think it isnt working.

Please forgive me for not explaining in the OP how the script actually is meant to work.

When a user looks for a title/game update ,if one is found it returns the results but before it returns them it checks if the update requires fw 3.60 or higher and if so tags it red on the versions equal or higher than 3.60.

If no results are found it simply returns invalid or no update found.

If the script is in use already it puts the second (or more) users in a Q, notices them that they are in Q and to sit tight and then it proceeds to notice them the results as there turn comes.



That was the original idea behind the script when he made it for me so again I apologise for not explaining that in my first post. As for how many use the trigger etc.. just isnt important ,it was something he put in there ,TIA



Edited by D00M (14/12/12 08:59 AM)

Top
#239993 - 14/12/12 10:46 AM Re: Calling info from a URL ,a little help please [Re: D00M]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
I didn't know there could be multiple updates, but that's actually not a problem at all just change the on sockread event to:
Code:
on *:sockread:game_id:{
  var %a,%c $sock($sockname).mark
  sockread -f %a
  while ($sockbr) {
    if (<tr><td><strong>* iswm %a) {
      noop $regex(parse,$nohtml(%a),/^(\d+(?:\.\d+)?)(.+\.pkg)(\d+) Bytes(.{40})(\d+(?:\.\d+)?)(?:Game:(.+)&laquo; Back)?/iS)
      %c Version: $regml(parse,1) - Url: $regml(parse,2) - Size: $regml(parse,3) - Checksum (sha1): $regml(parse,4) - Ps3 Min Version: $regml(parse,5)
      if ($regml(parse,6)) %c Game: $html2ascii($v1)
    }
    elseif (*Invalid title id or cannot find game* iswm %a) {
      %c Invalid title id
      sockclose $sockname
      return
    }
    sockread -f %a
  }
}
As for the others options, I'll eventually add them later, it's really quick.


Edited by Wims (14/12/12 10:50 AM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#239995 - 14/12/12 03:07 PM Re: Calling info from a URL ,a little help please [Re: Wims]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Nice edit Wims ,the script is working nice with it returning multiple results but it is gets flooded out if you do 2 or more requests in a row (straight after each other) that have multipule results.

I did note that when you search and get results for the gameid,the next query shows the name of the last search instead of the correct search.
Also some of the txt is coming back with non letters ,I pasted it below:

Code:
[11:49pm] <@D00M> !gameupdate BCUS98114
[11:49pm] *UPDBot* Game: Gran Turismo 5  <==(correct name)
[11:49pm] *UPDBot* UPD Version: 01.05 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0105-V0100-PE.pkg - File Size: 637423280 - Checksum (sha1): 1a154c8d1513f54f99782157be99b4e60af4cde1 - FW Version: 03.5000
[11:54pm] <@D00M> !gameupdate BLES01040
[11:54pm] *UPDBot* Game:Gran Turismo 5  <==(incorrect name)
[11:55pm] *UPDBot* UPD Version: 01.02 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLES01040/BLES01040_T2/74ef4755fbe429f3/EP0006-BLES01040_00-DEDSPC2PATCH0001-A0102-V0100-PE.pkg - File Size: 27265056 - Checksum (sha1): 9e6309f0c1eb21ac3c9ea370368eac8d388dd398 - FW Version: 03.4000
[11:55pm] <@D00M> !gameupdate BLES01040
[11:55pm] *UPDBot* Game: ツDead Spaceテ「ツツ「 2  <==(correct name but doesnt display correctly ,has non letters)
[11:55pm] *UPDBot* UPD Version: 01.02 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLES01040/BLES01040_T2/74ef4755fbe429f3/EP0006-BLES01040_00-DEDSPC2PATCH0001-A0102-V0100-PE.pkg - File Size: 27265056 - Checksum (sha1): 9e6309f0c1eb21ac3c9ea370368eac8d388dd398 - FW Version: 03.4000


How I have it atm:

Click to reveal..
Code:
#UPDFinder on
on *:LOAD:{
  if ($version < 7.14) {
    .unload -rs $+(",$script,")
    notice $nick 4PS3UPDFinder v1.00 Build 02 (Written By Wims) Requires mIRC v7.14 or newer to be installed successfully, script auto-unloaded.
  }
  else { notice $nick 3PS3UPDFinder v1.00 Build 02 (Written By Wims), Successfully loaded. }
}
on *:UNLOAD:{
  .unload -rs $+(",$script,")
  notice $nick 4PS3UPDFinder v1.00 Build 02 (Written By Wims), Successfully unloaded.
}
alias Game_id {
  sockclose game_id
  sockopen game_id yifan.lu 80
  sockmark game_id $1-
}
on *:sockopen:game_id:{ 
  sockwrite -n $sockname GET $+(/psn/?titleid=,$urlencode($gettok($sock(game_id).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:{
  var %a,%c $sock($sockname).mark
  sockread -f %a
  while ($sockbr) {
    if (<tr><td><strong>* iswm %a) {
      if ($regml(parse,6)) %c 15Game:4 $html2ascii($v1)
      noop $regex(parse,$nohtml(%a),/^(\d+(?:\.\d+)?)(.+\.pkg)(\d+) Bytes(.{40})(\d+(?:\.\d+)?)(?:Game:(.+)&laquo; Back)?/iS)
      %c 15UPD Version:8 $regml(parse,1) - 15URL: $regml(parse,2) - 15File Size:4 $regml(parse,3) - 15FW Version:3 $regml(parse,5)
    }
    elseif (*Invalid title id or cannot find game* iswm %a) {
      %c Invalid title id
      sockclose $sockname
      return
    }
    sockread -f %a
  }
}

alias urlencode return $regsubex($$1,/([\W\s])/Sg,$+(%,$base($asc(\t),10,16,2)))
alias nohtml return $regsubex($1,/<[^>]+(?:>|$)|^[^<>]+>/g,)
alias 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 html2ascii {
  var %r /&(.{2,6});/Ug
  return $regsubex($1-,%r, $iif(#* iswm \t, $chr($mid(\t,2) ), $HT2AS(\t) ))
}

on *:text:!gameupdate:#MY_CHAN:{
  notice $nick 15Invalid cmd, try again with !gameupdate <4GameID15> .
}
on *:text:?gameupdates:#MY_CHAN:{
msg $chan 15There has been3 %guds 15Total Game Updates Searched...
}
on *:text:!gameupdate &:#MY_CHAN:{
  inc %guds
  inc -u5 %ANTiQ
  if (%ANTiQ > 1) { notice $nick You must wait 5 seconds between searches | halt }
  if (!$sock(game_id)) game_id notice $nick $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].
}


I tried playing around with it somewhat and changed the game name to the top of the results instead of the bottom, added the on load echo, made it show in the menu/right click on screen ,added some color (although I couldn't work out how to get red txt for 3.60 or higher), and also added the count back in but can't seem to get the Q working again either.

Code:
  if ($play(0)) { notice $nick 15y0 4 $nick 14-=15You're in Queue so sit tight.. 9(4Q'd14:9 $v1 ) 14=-. }


I think my problem with the Q is that it isnt playing a txt file so if ($play(0)) is wrong?


Edited by D00M (14/12/12 04:51 PM)

Top
#240025 - 16/12/12 04:07 PM Re: Calling info from a URL ,a little help please [Re: D00M]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
The flood could be avoided with a lot of solution, a queue being one of them.
The only incorrect information (being the previous one) is the name of the game, and that only happen because you edited the code to display that name first, but you edited it badly, you're actually sending the information before it is retrieved, and you are being lucky that the way the code is done, the old information is still there.
Put the /if for the game's name right after the /noop $regex()

As for the random characters appearing, they come from the website, there's nothing I can do not to get them, but by assuming some things, like the fact that the game's name can only contain letter and number, we could get rid of them, you would need to tell me if this is true etc...

Note that when on unload triggers, it means the script has been unloaded, no need to re-unload it.

To display the text in red according to the version, use $iif():
Code:
%c 15UPD Version:8 $regml(parse,1) - 15URL: $regml(parse,2) - 15File Size:4 $regml(parse,3) - 15FW Version:3 $iif($regml(parse,5) >= 3.6,$+($chr(3),04,$v1)),$v1)


As for the queue, indeed, you don't have any queuing system, if ($play(0)) doesn't make sense, how would you want the queue to work?
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#240027 - 16/12/12 05:27 PM Re: Calling info from a URL ,a little help please [Re: Wims]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Hey Wims ,thanks for taking the time to come back and post. I added the above suggestions to the script and it seemed to be working fine but then I noticed 2 things:


1. It is now displaying red for the FW version equal or higher than 3.6 but it doesnt show the FW version info at all for anything under 3.60.

Click to reveal..
Code:
[2:53am] <@D00M> !gameupdate bles00963
[2:53am] *UPDBot* Game Name: ツF.E.A.R. 3
[2:53am] *UPDBot* UPD Version: 01.01 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLES00963/BLES00963_T0/315031ca5915f380/EP1018-BLES00963_00-F3PATCH000000001-A0101-V0100-PE.pkg - File Size: 25165680 - FW Version: 03.6000
[2:55am] <@D00M> !gameupdate bcus98114
[2:55am] *UPDBot* UPD Version: 01.05 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0105-V0100-PE.pkg - File Size: 637423280 - FW Version:
[2:55am] *UPDBot* UPD Version: 01.06 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0106-V0100-PE.pkg - File Size: 314873312 - FW Version:
[2:55am] *UPDBot* UPD Version: 01.07 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0107-V0100-PE.pkg - File Size: 48650880 - FW Version:
[2:55am] *UPDBot* UPD Version: 01.08 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0108-V0100-PE.pkg - File Size: 1805056 - FW Version:
[2:55am] *UPDBot* UPD Version: 01.09 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0109-V0100-PE.pkg - File Size: 49298736 - FW Version:
[2:55am] *UPDBot* UPD Version: 01.10 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0110-V0100-PE.pkg - File Size: 398418784 - FW Version: 03.6000
[2:55am] *UPDBot* UPD Version: 01.11 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0111-V0101-PE.pkg - File Size: 64123456 - FW Version: 03.6000
[2:55am] *UPDBot* UPD Version: 01.12 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0112-V0100-PE.pkg - File Size: 13512448 - FW Version: 03.6000
[2:55am] *UPDBot* UPD Version: 01.13 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0113-V0100-PE.pkg - File Size: 1175872 - FW Version: 03.6000
[2:55am] *UPDBot* UPD Version: 02.00 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0200-V0100-PE.pkg - File Size: 1249152240 - FW Version: 03.7000
[2:55am] *UPDBot* UPD Version: 02.01 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0201-V0100-PE.pkg - File Size: 117369568 - FW Version: 03.7000
[2:55am] *UPDBot* UPD Version: 02.02 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0202-V0100-PE.pkg - File Size: 256980640 - FW Version: 03.7000
[2:55am] *UPDBot* UPD Version: 02.03 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0203-V0100-PE.pkg - File Size: 234996768 - FW Version: 03.7000
[2:55am] *UPDBot* UPD Version: 02.04 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0204-V0100-PE.pkg - File Size: 81953344 - FW Version: 03.7000
[2:55am] *UPDBot* UPD Version: 02.05 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0205-V0100-PE.pkg - File Size: 25323536 - FW Version: 03.7000
[2:55am] *UPDBot* UPD Version: 02.06 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0206-V0100-PE.pkg - File Size: 497668864 - FW Version: 04.1000
[2:55am] *UPDBot* UPD Version: 02.07 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0207-V0100-PE.pkg - File Size: 2244720 - FW Version: 04.1000
[2:55am] *UPDBot* UPD Version: 02.08 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0208-V0100-PE.pkg - File Size: 237496816 - FW Version: 04.1000
[2:55am] *UPDBot* Game Name: ツGran Turismo 5
[2:55am] *UPDBot* UPD Version: 02.09 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BCUS98114/BCUS98114_T52/926756a8e8e39359/UP9000-BCUS98114_00-0000000000000000-A0209-V0100-PE.pkg - File Size: 106075712 - FW Version: 04.1000


2. The game name now showed the first time at the top but didn't show at all on the second return and if you get a large return of results, it puts the name on the second last line.
I'm guessing I just did a bad edit again so please forgive me. blush

Code:
on *:sockread:game_id:{
  var %a,%c $sock($sockname).mark
  sockread -f %a
  while ($sockbr) {
    if (<tr><td><strong>* iswm %a) {
      noop $regex(parse,$nohtml(%a),/^(\d+(?:\.\d+)?)(.+\.pkg)(\d+) Bytes(.{40})(\d+(?:\.\d+)?)(?:Game:(.+)&laquo; Back)?/iS)
      if ($regml(parse,6)) %c 15Game Name:4 $html2ascii($v1)
      %c 15UPD Version:8 $regml(parse,1) - 15URL: $regml(parse,2) - 15File Size:4 $regml(parse,3) - 15FW Version:3 $iif($regml(parse,5) >= 3.6,$+($chr(3),04,$v1)),$v1)
    }


Quote:
As for the random characters appearing, they come from the website, there's nothing I can do not to get them, but by assuming some things, like the fact that the game's name can only contain letter and number, we could get rid of them, you would need to tell me if this is true etc...


As far as I'm aware there numbers, letters hyphons and colons in the game names other than the & sign.

Example:
Champion Jockey: G1 Jockey & Gallop Racer
Cars: Race-O-Rama

For the Q itself I did try if ($play((0) which works for another script I use but that is for playing a txt file and couldnt get it to work with this script.

Code:
if ($play(0)) { notice $nick 4 $nick 14-=15You're in Queue so sit tight.. 3(Q'd at:9 $v1 3) 14=-. }


I did try to add an antiQ for the flood and it seems to work but the notice to the user gets displayed "after" the results have finished displaying to the first user.
How do I make it display the Q and antiQ msg the user while it is returning the results to another user?

Code:
on *:text:!gameupdate &:#MY_CHAN:{
   inc %guds
   inc -u5 %ANTiQ
   if (%ANTiQ > 1) { notice $nick 15You must wait 5 seconds between searches. | halt }
else {
   if (!$sock(game_id)) game_id notice $nick $upper($2)
 }
}


One last thing is how would I slow the results down? I know I can put 1000 or 2000 for 1 or 2 seconds per line but I just don't know where it goes in your script.

Again Wims thanks for the time and effort you are taking here and look forward to your reply,

D00M


Edited by D00M (16/12/12 06:01 PM)

Top
#240029 - 16/12/12 06:53 PM Re: Calling info from a URL ,a little help please [Re: D00M]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
My bad for the $iif, there is an extra ')' use:
Code:
$iif($regml(parse,5) >= 3.6,$+($chr(3),04,$v1),$v1)


Quote:
2. The game name now showed the first time at the top but didn't show at all on the second return and if you get a large return of results, it puts the name on the second last line.
I'm guessing I just did a bad edit again so please forgive me.
Not your fault, that simply because in the source code, the game's name is always at the end, after the last url, you would need to temporarily store all the informations, wait for the name, then display it and display the rest of informations.

As you said, $play is related to playing files, which you are not doing here, why are you trying to use $play?
You need to make a queue system: store the request, once a request is done, check if there's a request in the queue and handle it, if so.

The /timer command can be used to delay (ie. slow down) another command.

I'll try to add those modifications later, but you're welcome wink
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#240030 - 16/12/12 07:45 PM Re: Calling info from a URL ,a little help please [Re: Wims]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Ah nice ,the results are now working with red as 3.60 or higher and the lower FW is now showing. Thinking back at the original script I do believe he did write to a temp file to capture the info as you suggested (or something to that effect) and then have it write to the channel. I can only guess that was this part of his script that i'd see in the status window:

* Removed 'D:\ProgramFiles\mIRC\psnupdate'

Quote:
The /timer command can be used to delay (ie. slow down) another command.


I thought timers were only used for issuing commands and not controlling the time of the output. I see I have over looked this.

Thanks again Wims and again look forward to your reply.

D00M

Top
#240031 - 16/12/12 08:00 PM Re: Calling info from a URL ,a little help please [Re: D00M]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
Timers can be used for controlling when things are displayed. Of course, you can also use the built-in flood control in mIRC to avoid flooding the channel (Alt-O > IRC > Flood). In most cases, it works well.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#240045 - 17/12/12 05:07 PM Re: Calling info from a URL ,a little help please [Re: D00M]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
Here is the final version:
Code:
#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 {
  sockclose game_id
  sockopen game_id yifan.lu 80
  inc %guds
  sockmark game_id $1-
}
on *:sockopen:game_id:{
  if ($sockerr) { unset %queue | 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) { unset %queue | return }
  var %a,%c $gettok($sock($sockname).mark,1,44),%g
  sockread %a
  while ($sockbr) {
    if (<tr><td><strong>* iswm %a) {
      noop $regex(parse,$nohtml(%a),/^(\d+(?:\.\d+)?)(.+\.pkg)(\d+) Bytes(.{40})(\d+(?:\.\d+)?)(?:Game:(.+)&laquo; Back)?/iS)
      %g = $regsubex($html2ascii($regml(parse,6)),/[^- :&[:alnum:]]/g,)
      sockmark $sockname $addtok($sock($sockname).mark,UPD Version: $regml(parse,1) - URL: $regml(parse,2) - File Size: $regml(parse,3) - FW Version: $iif($regml(parse,5) >= 3.6,$+($chr(3),04,$v1),$v1),44)
      if (%g) {
        %c Game: %g
        sockmark $sockname $deltok($sock($sockname).mark,1,44)      
        tokenize 44 $sock($sockname).mark
        set -u %counter 1
        output %c $0 $*
        sockclose $sockname
        return
      } 
    }
    elseif (*Invalid title id or cannot find game* iswm %a) {
      %c Invalid title id
      sockclose $sockname
      queue
      return
    }
    sockread %a
  }
}

alias queue {
  unset %counter
  if (%queue) {
    .timer -h 1 0 game_id $gettok(%queue,1,44)
    set -e %queue $deltok(%queue,1,44)
  }
}

alias -l safe bset -ct &a 1 $1 | return $!utfdecode($regsubex(safe, $bvar(&a,1-) ,/(\d+)(?: |$)/g,$chr(\1)))

alias -l output {
  var %c $1-2,%msg $4-
  .timer 1 %counter $safe(%c %msg) $(|) if ( %counter == $3 ) queue
  inc -u %counter

}
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:{
  var %c .notice $nick,%d $sock(game_id)
  if (!$2) notice $nick 15Invalid cmd, try again with !gameupdate <GameID> .
  elseif ($sock(game_id)) set %queue $addtok(%queue,%c $upper($2),44)
  else 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].
}
Note that I removed some control code (colors etc) because they were not used correctly, some of them were sticked to $function() and were ignored anyway. I'm sure you'll find how to add them back.
Also, why is the code is limited to 7.14+ ?


Edited by Wims (17/12/12 06:05 PM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#240046 - 18/12/12 03:37 AM Re: Calling info from a URL ,a little help please [Re: Wims]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Hey Wims ,

I put in your script and it works great with not being flooded out and the results are nicely timed now. The game name is now also fixed and displays corectly at the top and without the non letters.

I'm not sure the Q is working as it seems to respond to me if I did 3 triggers in a row (returned all three at the same time instead of after each other) but the timer seems to have stopped it from flooded so maybe the Q isnt needed now?

Also I don't believe the invalid command or invalid gameid part is working right as there is no responce from the bot when the commands are issued.

Code:
[1:12pm] <@D00M> !gameupdate             <==(No responce for invalid command)
[1:12pm] <@D00M> !gameupdate test        <==(No responce from the bot).
[1:12pm] <@D00M> !gameupdate blus30658   <==(valid gameid but with no updates,no responce from the bot).
[1:13pm] <@D00M> !gameupdate blus3065    <==(invalid gameid, no responce from the bot).
[1:15pm] <@D00M> !gameupdate bles00948   <==(valid gameid with updates,bot responds as expected).
[1:15pm] *UPDBot* Game: Dead Rising 2
[1:15pm] *UPDBot* UPD Version: 01.02 - URL: http://b0.ww.np.dl.playstation.net/tppkg/np/BLES00948/BLES00948_T1/0ba7aa40d6e3ea4e/EP0102-BLES00948_00-DR2PATCH20000000-A0102-V0100-PE.pkg - File Size: 18130976 - FW Version: 03.2000


Quote:
Also, why is the code is limited to 7.14+ ?


That is the version the bot is using so I was just playing it safe and taging it with that version.

Also would you be able to explain/breakdown the code a little for me so as I may understand/learn from it better.

Again ,thanks for your time and efforts Wims it is really appreciated. smile

EDIT: ok got the responce working for no game update found, i edited this line

Quote:

elseif (*Invalid title id or cannot find game* iswm %a) {
%c 4Invalid GameID or no update available.
sockclose $sockname
queue
return
}
sockread -f %a
}
}

added the -f and it gave me the responce for no update or invalid gameid wink

Still trying to get this part to work,
Code:
  if (!$2) notice $nick 15Invalid cmd, try again with !gameupdate <GameID> .


EDIT#2: I got it working with how it was in the old script:

Code:
on *:text:!gameupdate:#MY_CHAN:notice $nick 15Invalid cmd, try again with !gameupdate <GameID> .


I think everything is now working nicely thanks to you Wims. As asked above if you find the time to give me a little breakdown of the code would be great. Thanks again for all your help.

/me slips Wims a cookie wink


Edited by D00M (18/12/12 08:58 AM)

Top
#240047 - 18/12/12 11:31 AM Re: Calling info from a URL ,a little help please [Re: D00M]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Looks like I spoke too soon :P

It seems that for what ever reason when I tried to edit the word "URL" to "DOWNLOAD" I now get the following error: * Line too long: $addtok (line 29, PS3UPDFinder.mrc)

Channel:

Code:
[9:23pm] <D00M> !gameupdate BCES00569
[9:23pm] <D00M> !gameupdate bles00948
[9:23pm] *UPDBot* Game Name: Dead Rising 2
[9:23pm] *UPDBot* UPD Version: 01.02 - DOWNLOAD: http://b0.ww.np.dl.playstation.net/tppkg/np/BLES00948/BLES00948_T1/0ba7aa40d6e3ea4e/EP0102-BLES00948_00-DR2PATCH20000000-A0102-V0100-PE.pkg - File Size: 18130976 - FW Version: 03.2000
[9:23pm] <D00M> !gameupdate BCES00569


Status window:

Code:
覧覧覧覧覧覧覧覧覧覧
* Line too long: $addtok (line 29, PS3UPDFinder.mrc)
覧覧覧覧覧覧覧覧覧覧
[9:23pm] -> -D00M- Game Name: Dead Rising 2
覧覧覧覧覧覧覧覧覧覧
* Timer 1 activated
覧覧覧覧覧覧覧覧覧覧
[9:23pm] -> -D00M- UPD Version: 01.02 - DOWNLOAD: http://b0.ww.np.dl.playstation.net/tppkg/np/BLES00948/BLES00948_T1/0ba7aa40d6e3ea4e/EP0102-BLES00948_00-DR2PATCH20000000-A0102-V0100-PE.pkg - File Size: 18130976 - FW Version: 03.2000
覧覧覧覧覧覧覧覧覧覧
* Timer 1 halted
覧覧覧覧覧覧覧覧覧覧
* Line too long: $addtok (line 29, PS3UPDFinder.mrc)
覧覧覧覧覧覧覧覧覧覧


Line 29:

Code:
      sockmark $sockname $addtok($sock($sockname).mark,UPD Version: $regml(parse,1) - URL: $regml(parse,2) - File Size: $regml(parse,3) - FW Version: $iif($regml(parse,5) >= 3.6,$+($chr(3),04,$v1),$v1),44)

changed to 

      sockmark $sockname $addtok($sock($sockname).mark,UPD Version: $regml(parse,1) - DOWNLOAD: $regml(parse,2) - File Size: $regml(parse,3) - FW Version: $iif($regml(parse,5) >= 3.6,$+($chr(3),04,$v1),$v1),44)

The only thing I did was removed the . on .notice and changed the word URL to DOWNLOAD. It only happens on that one game so far ,maybe because the game has such a large return of results?

It also appears that some of the results do not have a min ps3 version on the website (the space is blank) so there script just hangs and doesnt know what to do. I'm guessing it is the websites fault.

http://yifan.lu/psn/?titleid=BCES00050&env=np

Is there anyway to get around this?


Edited by D00M (18/12/12 11:34 AM)

Top
#240050 - 18/12/12 09:54 PM Re: Calling info from a URL ,a little help please [Re: D00M]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
I fixed everything wink! I'll comment the code later though.., or someone might explain it for me.

Code:
#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 {
  sockclose game_id
  sockopen game_id yifan.lu 80
  inc %guds
  sockmark game_id $1-
}
on *:sockopen:game_id:{
  if ($sockerr) { unset %queue | 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) { unset %queue | return }
  var %a,%c $gettok($sock($sockname).mark,1,44),%g,%d,%e 1
  sockread %a
  while ($sockbr) {
    if (<tr><td><strong>* iswm %a) {
      noop $regex(parse,$nohtml(%a),/^(\d+(?:\.\d+)?)(.+\.pkg)(\d+) Bytes(.{40})(\d+(?:\.\d+)?|)(?:Game:(.+)&laquo; Back)?/iS)
      %g = $regsubex($html2ascii($regml(parse,6)),/[^- :&[:alnum:]]/g,)
      %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 (%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:#...:msg $chan There has been %guds Total Game Updates Searched...

on *:text:!gameupdate*:#...:{
  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].
}



Edited by Wims (18/12/12 09:55 PM)
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#240052 - 19/12/12 05:04 AM Re: Calling info from a URL ,a little help please [Re: Wims]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Quote:

I fixed everything wink! I'll comment the code later though.., or someone might explain it for me.


Indeed you did and I can't thank you enough Wims. The script is now working very nicely with everything. I also see you got around the no min ps3 version and converted the bytes to MB ,nice touch and earns you a bonus cookie for all your hard efforts wink

/me slips Wims a bonus cookie grin

Again thanks Wims ,this is a lot better than the old script by far ,no more stupid parsing errors yay :P If you happen to find the time or as you suggested maybe someone else out there can give me a breakdown/rundown of the code would be awesome ,thanks again wink

Top
#240065 - 21/12/12 02:55 PM Re: Calling info from a URL ,a little help please [Re: D00M]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Hey Wims ,I'm not really sure (I'm guessing it is all the errors on the website) what's going on but the script seems to break/hang with these 2 games. So far the script has been working perfect but if I search for Uncharted 2 or Uncharted 3 GameIDs ,the script hangs and you have to restart the client to get it to work again. It wont show any results for any of the following GameID's:

http://yifan.lu/psn/?titleid=BCAS20097&env=np <= Uncharted 2: Among Thieves
http://yifan.lu/psn/?titleid=BCES00509&env=np <= Uncharted 2: Among Thieves
http://yifan.lu/psn/?titleid=BCES00757&env=np <= Uncharted 2: Among Thieves
http://yifan.lu/psn/?titleid=BCUS98123&env=np <= Uncharted 2: Among Thieves
http://yifan.lu/psn/?titleid=BCES01670&env=np <= Uncharted 3: Drake's Deception Game of the Year


I've tested a lot of GameID's and from what I can tell these are the ones that break/hang the script, other than that it has been working perfect. If you wouldn't mind taking a look Wims that would be great ,thanks again

D00M wink


Edited by D00M (21/12/12 02:56 PM)

Top
#240075 - 22/12/12 04:14 PM Re: Calling info from a URL ,a little help please [Re: D00M]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3494
Loc: France
Yeah, the website isn't really consistent lol.
I've added a fix and added some comments, but I don't really know how deep I should explain things, you would need to tell me what you don't understand wink

Code:
#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:(.+)(?:&laquo; 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].
}

_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#240077 - 22/12/12 06:30 PM Re: Calling info from a URL ,a little help please [Re: Wims]
D00M Offline
Babel fish

Registered: 28/10/05
Posts: 71
Originally Posted By: Wims
Yeah, the website isn't really consistent lol.


Yes unfortunately I haven't found another site that offers a way to search for the updates hence asking earlier would it be better to just cut the middle man and get the results straight from the source, the page does seem to have a lot of errors.

I tested your fix and it is working nice with Uncharted 2 and 3 but it is adding the word "Back" to every other game name lol. This really isn't a big deal just thought id mention it.
Example below:

Code:
[4:29am] <@D00M> !gameupdate bcas20097
[4:30am] *UPDBot* Game: Uncharted 2: Among Thieves
[4:30am] *UPDBot* UPD Version: 01.01 - DOWNLOAD: http://b0.ww.np.dl.playstation.net/tppkg/np/BCAS20097/BCAS20097_T8/91654e179049c706/HP9000-BCAS20097_00-UNCHARTED2PATCH1-A0101-V0100-PE.pkg - File Size: 19.7MB - FW Version: 02.8000
[4:31am] <@D00M> !gameupdate bces00569
[4:31am] *UPDBot* Game: Gran Turismo 5 Back
[4:31am] *UPDBot* UPD Version: 01.05 - DOWNLOAD: http://b0.ww.np.dl.playstation.net/tppkg/np/BCES00569/BCES00569_T50/e4124567d687458f/EP9001-BCES00569_00-0000000000000000-A0105-V0100-PE.pkg - File Size: 607MB - FW Version: 03.5000
[4:33am] <@D00M> !gameupdate BCES00031
[4:33am] *UPDBot* Game: SingStar update Back
[4:33am] *UPDBot* UPD Version 05.20 - DOWNLOAD: http://b0.ww.np.dl.playstation.net/tppkg/np/BCES00031/BCES00031_T125/e62ccbd90fc52ace/EP9000-BCES00031_00-SINGSTARPS3V0520-A0520-V0100-PE.pkg - File Size: 87.5MB - FW Version: 04.1000


I was looking through your code on this line ,is the ; a typo?

noop $regex(parse,$nohtml(%a),/^(\d+(?:\.\d+)?)(.+\.pkg)(\d+) Bytes(.{40})(\d+(?:\.\d+)?|)(?:Game:(.+)(?:&laquo; Back)?)?/iS

I only ask as it has the word Back next to it and that is what is coming up on the game name and I always thought that was used to ignore a line, TIA smile

D00M.

Top
Page 1 of 2 1 2 >