Scraping dynamic data with imacro to excell

北城以北 提交于 2019-12-25 13:59:34

问题



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


回答1:


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).



来源:https://stackoverflow.com/questions/30892937/scraping-dynamic-data-with-imacro-to-excell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!