Thread URL aus HTML extrahieren (9 answers)
Opened by Salway at 2014-08-01 15:54

GwenDragon
 2014-08-02 15:49
#176674 #176674
User since
2005-01-17
14607 Artikel
Admin1
[Homepage]
user image
URI::Find findet doch das erste Vorkommen.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use URI::Find;

my $search = '1001_.jpg';

my $found;
my $finder = URI::Find->new(
   sub {
      my $uri = shift;
          return if $found;
          say $uri if ($uri =~ m/\Q$search\E$/ && ++$found);
   }
);

local $/ = undef;
my $line = <DATA>;

$finder->find(\$line);
__DATA__
http://site/images/I/61cbCGzH1hL1._SL1001_.jpg
http://site/images/I/710TxT7aX0L._SY355_.jpg
http://site/images/I/61cbCGzH1hL2._SL1001_.jpg
http://site/images/I/61WBOyRAhNL3._SL1001_.jpg
http://site/images/I/41c3CszH1hL4._SL1001_.jpg
http://site/images/I/61E9RFObPiL._SX522_.jpg
http://site/images/I/71cbCszH1hL5._SL1001_.jpg

ergibt
http://site/images/I/61cbCGzH1hL1._SL1001_.jpg

View full thread URL aus HTML extrahieren