Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
344 views
in Technique[技术] by (71.8m points)

Scraping dynamic data with imacro to excell


I want to scrape dynamic data (refreshable every 4 seconds and it's a number ) with imacro and represent that number changing along the time in excell ( or any other way ).

How can i do this ? Imacro, as further as i know can get the data but can it scrap a dynamic one .

The code is from a basketball game on Flashscore ,exactly the scores table between 2 teams :
Here is an example for a game table

<table id="parts" class="parts-first horizontal">
    <tbody>
            <tr class="odd">
                <td class="score"><span class="rb">69</span</td>
                <td class="score part"><span class="p1_home">31</span></td>
            </tr>
            <tr class="even">
                <td class="score"><span class="rb">63</span></td>
                <td class="score part"><span class="p1_away">17</span></td>
            </tr>
    </tbody>
</table>

that gives those two lines data:
69 31
63 17

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here is the more detailed answer with a code.

TAG POS=1 TYPE=TD ATTR=CLASS:"score" EXTRACT=TXT
SET !EXTRACT EVAL("'{{!EXTRACT}}'.match(/\d+/)[0];")
TAG POS=1 TYPE=TD ATTR=CLASS:"score part" EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=scores.csv
TAG POS=2 TYPE=TD ATTR=CLASS:"score" EXTRACT=TXT
SET !EXTRACT EVAL("'{{!EXTRACT}}'.match(/\d+/)[0];")
TAG POS=2 TYPE=TD ATTR=CLASS:"score part" EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=scores.csv
WAIT SECONDS=4

Play this macro in loop mode (button ‘Play (Loop)’) with the max. number of loops equal to a very big integer (e.g. 99999).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...