Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Little Help Needed
#1
I'm fairly new to the scene and have been playing about with a few macros and have managed to get them working to a reasonably different level, so I thought I'd up my level.

What I'm looking for is a bit of help on the following -

I'm looking to grab specific text from within the source code page of a specific webpage, extract it and do a search and find function on a different page.

The piece of source code mentioned is

<meta name="description" content="jonas - posted in Evaluation Stage: Player InfoPlayer: jonas goncalves oliveiraRating: 81Position: attLeavingGamertag: dizzyTeam: derbyDivision: xb div 1 eastGoing toGamertag: ninjabeanTeam: spursDivision: ps3 div 1 westFor
*insert cost and/or players* 45m" />

I'm looking to extract anything AFTER "Player Info Player:" and BEFORE "rating" so in this case the result would return 'jonas goncalves oliveria".

I do have a piece of code but I think it's completely wrong so wont bother posting it.

Any help greatly appreciated.
#2
Use regular expression.

Macro Macro2193
Code:
Copy      Help
;text for testing
str s=
;text before
;<meta name="description" content="jonas - posted in Evaluation Stage: Player InfoPlayer: jonas goncalves oliveiraRating: 81Position: attLeavingGamertag: dizzyTeam: derbyDivision: xb div 1 eastGoing toGamertag: ninjabeanTeam: spursDivision: ps3 div 1 westFor
;*insert cost and/or players* 45m" />
;text after

str rx=
;<meta\s+name="description"\s*content=[^>]+Player:\s*([^>]+?)\s*Rating:
str name
if(findrx(s rx 0 1 name 1)<0) out "not found"; ret
out name
#3
Thanks very much for your help.

I've managed to find another piece of the source code which will be more useful and was wondering if you could expand on that piece of code.

<div itemprop="commentText" class='post entry-content '>

<!--cached-Thu, 23 Jan 2014 23:16:45 +0000--><span style="font-size:18px;"><strong>Player Info</strong></span><br><br><strong>Player</strong>: Leo Baptistao<br><strong>Rating</strong>: 76<br><strong>Position</strong>: ATT <br><br><br><span style="font-size:18px;"><strong>Leaving</strong></span><br><br><strong>Gamertag</strong>: Tommo-uk-<br><strong>Team</strong>: Atletico Madrid<br><strong>Division</strong>: PS3 Prem<br><br><br><span style="font-size:18px;"><strong>Going to</strong></span><br><br><strong>Gamertag</strong>: KingJenko<br><strong>Team</strong>: Barcelona<br><strong>Division</strong>: PS3 Prem<br><br><br>[size=5]<strong>For</strong>[/size<br><br>30m<br><br>Cheers mate

<br />

</div>


That's the code Id like to use for my extractions, What I want to out is what ever is between '<strong>Player</strong>:' and '<br><strong>Rating</strong>:' ,obviously that will display Leo Baptistao on this occasion but this player name will change on every occasion and I'm struggling to incoporate that variable.

Again, greatly appreciate the help.
#4
Learn regular expressions. It is not so difficult, and will be useful in the future, not only in QM. You can find web pages or programs that can help you to build regular expressions. I just showed an example how to test it in QM.


Forum Jump:


Users browsing this thread: 1 Guest(s)