使用imacro将动态数据抓取到excell [英] Scraping dynamic data with imacro to excell

查看:97
本文介绍了使用imacro将动态数据抓取到excell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想用imacro抓取动态数据(每4秒钟刷新一次,它是一个数字),并在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 ).

我该怎么做?据我所知,Imacro可以获取数据,但可以取消动态数据.

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

该代码来自 Flashscore 上的篮球比赛,准确地是两支球队之间的得分表:
这是一个游戏桌的例子

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>

给出这两行数据:
69 31
63 17

that gives those two lines data:
69 31
63 17

推荐答案

这是带有代码的更详细的答案.

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

在循环模式下播放此宏(按钮播放(循环)"),最大循环数等于一个非常大的整数(例如99999).

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

这篇关于使用imacro将动态数据抓取到excell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆