Thread URL aus HTML extrahieren
(9 answers)
Opened by Salway at 2014-08-01 15:54
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 |