小编Bac*_*ass的帖子

如何使用WWW :: Mechanize获取与正则表达式匹配的链接?

我正在尝试使用正则表达式来捕获链接,但不能.我有所有链接,但有许多链接不需要.

我所做的就是抓住所有链接: http://valeptr.com/scripts/runner.php?IM= 遵守这种模式.

我把我正在做的脚本:

use warnings;
use strict;
use WWW::Mechanize;
use WWW::Mechanize::Sleepy;

my $Explorador =

    WWW::Mechanize->new(

       agent =>
             'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624',

       sleep => '5..20'
    );

#Proceed to access the URL to find all the links in emails
$Explorador->get("file:/home/alejandro/Escritorio/hehe.php.html");

#If you want debug DOM Document.
#print $Explorador->content();

my @links = $Explorador->links;

foreach my $link (@links) {

   # Retrieve the link URL like:
   # http://valeptr.com/scripts/runner.php?IM=0cdb7d48110375.
   my $href = $link->url;

   foreach my $s ($href) { #Aqui la …
Run Code Online (Sandbox Code Playgroud)

perl www-mechanize

1
推荐指数
1
解决办法
1230
查看次数

标签 统计

perl ×1

www-mechanize ×1