如何使用Perl屏幕抓取? [英] How can I screen scrape with Perl?

查看:81
本文介绍了如何使用Perl屏幕抓取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要显示一些存储在网站中的值,因为我需要抓取网站并从表中获取内容.有什么想法吗?

I need to display some values that are stored in a website, for that I need to scrape the website and fetch the content from the table. Any ideas?

推荐答案

如果您熟悉jQuery,则可能想查看

If you are familiar with jQuery you might want to check out pQuery, which makes this very easy:

## print every <h2> tag in page
use pQuery;

pQuery("http://google.com/search?q=pquery")
    ->find("h2")
    ->each(sub {
        my $i = shift;
        print $i + 1, ") ", pQuery($_)->text, "\n";
    });

还有 HTML :: DOM .

但是,无论您做什么,都不要为此使用正则表达式.

Whatever you do, though, don't use regular expressions for this.

这篇关于如何使用Perl屏幕抓取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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