Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
ixy
Novice


Joined: 18 Mar 2007
Posts: 39

PostPosted: Sat Jan 02, 2010 9:46 pm   

Gathering data from website
 
I once asked on the zmud forum about making zmud havest data from the mud website to use in scripts and was told it was not possible and that cmud could do it, and that the person had posted a few examples already.

However, im not sure what this function is _actually_ called, and cant seem to find these examples, can anyone tell me what its called (or a link to the thread) or post an example?
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Jan 02, 2010 10:03 pm   
 
Check out this topic:

http://forums.zuggsoft.com/forums/viewtopic.php?t=32898&highlight=

Charneus
Reply with quote
ixy
Novice


Joined: 18 Mar 2007
Posts: 39

PostPosted: Sat Jan 02, 2010 11:57 pm   
 
Thank you :)
Reply with quote
ixy
Novice


Joined: 18 Mar 2007
Posts: 39

PostPosted: Thu Jan 07, 2010 9:49 pm   
 
After a fair bit of reading and experimenting with lua (and installing luasocket correctly :x), ive managed to make a few simple scripts to gather tidbits of data, have come across 3 issues i could use some help with thought.

#1 Im not sure how to use a wildcard in the trigger as a variable in the actual lua to check as a pattern.

Example #regex {[CLAN] playername: 'path (.+)'} id like to be able to check the %1 wild card against the page as part of a string.match.

#2 The website page i want to check requires i enter the above variable in a search box, and then navigate to the profile in question.

Site: http://www.materiamagica.com/towne/players/index.php

The "quick search" box on the left side the box i need to fill in, if the name is a match, it navigates to the correct page, if not it brings up matching strings of that occurence (which i assume i could return as a nil value for no match?)

So, im not sure how i fill in and enter the box to submit the search query.

#3 The information on the page that i require is split, example:

Site: http://www.materiamagica.com/towne/players/registry_view.php?pr_id=4287&z=bd2e4eac204286df2e7c10284101eb42

I'd like to capture the class info and return it, but im not sure how to set up a multi line capture via lua.

If any of this is actually possible, i'd appreciate the help :p
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Jan 08, 2010 1:50 pm   
 
#2. You're in the same realm as the cookie issue and will need to do a POST.
_________________
Taz :)
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Sat Jan 28, 2012 10:51 am   
 
ixy,

i know this is an older topic but cmud pro has support for %url that might help

i.e.

i used the following to find the link to the search box and iterate through the pages.

Code:

  $char=%-1
  $u=%url(%concat("http://www.materiamagica.com/community/search?option=com_community&view=search&Itemid=5&q=",$char))
  $page=$u.Get
   #CALL %regex($page,%concat("<a href=""(.+)""><strong>",$char),$p1url)
  #echo %crlf
  #echo "P1URL" %concat("http://www.materiamagica.com/community/search?option=com_community&view=search&Itemid=5&q=",$char)
  #echo "P1url" $p1url
  $u2=%url(%concat("http://www.materiamagica.com/",$p1url))
  $page2=$u2.Get
  #CALL %regex($page2,%concat("<p>",$char,"(.*)</p>\n\s+<p>(.*)</p>\n\s+<p>(.*)</p>\n\s+<p>(\w+)\s+(\w+)"),$level,$desc,$class,$gender,$race)
  #echo "p2url" %concat("http://www.materiamagica.com",$p1url)
  #echo "Level" $level
  #echo "Description" $desc
  #echo "Classes" $class
  #echo "Gender" $gender
  #echo "Race" $race
 


I will try to post more.. I had a working copy of this up and running without any lua addons but in testing i screwed it up again. This at the current moment is working for me but with the new website i need to go over it with a fine tooth comb. I figure it might give you a start though.

Tam
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Tue Jan 31, 2012 12:16 am   
 
Ixy here is a more real example

Code:

  $char=%1
  $u=%url(%concat("http://annwn.info/player/",$char))
  $page=$u.Get
   #CALL %regex($page,%concat("<a href=""/player/",$char,"/levels"">(.+)</a>",),$level)
   #CALL %regex($page,"<td width=""200"">Race:</td>\s+<td>(.+)</td>",$race) 
   #CALL %regex($page,"<td>Gender:</td>\s+<td>(.+)</td>",$gender)
   #CALL %regex($page,"<a href=""/skill/list/(.+)"">",$classes)
   #CALL %regex($page,"<a href=""/clan/.+"">(.+)</a></td>",$clan)
   #CALL %regex($page,"<td>First Seen:</td>\s+<td>(.+)</td>",$firstseen)
   #CALL %regex($page,"<td>Last Login:</td>\s+<td>\s+(.+)\s+</td>",$lastseen)
   #CALL %regex($page,"<td>Time Played This Month:</td>\s+<td>(.+)</td>",$thismonth)
   #SEND "relay |G" $char "|x|w["$level"]|x |GClan:|x" $clan  "|GRace:|x"$gender $race "|GClasses:|x" $classes"
   getvuln $race
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net