How can I screen scrape with Perl?

前端 未结 10 846
夕颜
夕颜 2020-12-13 23:28

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?

10条回答
  •  盖世英雄少女心
    2020-12-13 23:48

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

    ## print every 

    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"; });

    There's also HTML::DOM.

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

提交回复
热议问题