Leser: 26
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
my $ua = new LWP::UserAgent; $ua->agent("MudGuard/1.0"); # rl container aufrufen my $req_relink = HTTP::Request->new("GET", http://www.r e l i n k.us/f/504d78064000bf8b7ee14c05027311); my $res_relink = $online_check_ua->request($req_relink); my $site_relink_container = $res_relink->content; # verschlüsselte links für jeden eintrag aus $site_relink_container matchen # sieht dann so aus ... : # http://r e l i n k.us/getfile.php?cid=52ea6cefa709785cab84e64627ac5c&lid=15423925 # cid ist der übergabe parameter, der per javascript an das sich öffnende # fenster übergeben wird, wo dann der eigentliche download von ul steht. # das klappt aber leider nicht per skript. wenn ich also folgendes mache: # rl container aufrufen my $req_relink = HTTP::Request->new("GET", 'http://r e l i n k.us/getfile.php?cid=52ea6cefa709785cab84e64627ac5c&lid=15423925'); my $res_relink = $online_check_ua->request($req_relink); my $site_relink = $res_relink->content; dann steht im content, nicht die seite, die im javascriptfenster angezeigt wird, sondern index.php von r e l i n k ...
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 26 27
#!/usr/bin/perl -w use strict; use warnings; require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->agent("MudGuard/1.0"); my $response = $ua->get('http://www.r e link.us/f/504d78064000bf8b7ee14c05027311'); if ($response->is_success) { my $content = $response->decoded_content; if ($content =~ /download\.php\?id\=([^"]+)/) { my $link = $1; print "Finde Link: $link\n"; my $response = $ua->get("http://www.r e link.us/download.php?id=$link"); if ($response->is_success) { open (my $fh,'>','testcontainer2.dlc') or die $!; binmode $fh; print $fh $response->decoded_content; } else { die "Download gescheitert: " . $response->status_line; } } } else { die $response->status_line; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
ppm> s firefox
Downloading ActiveState Package Repository packlist...done
Updating ActiveState Package Repository database...done
Downloading uwinnipeg packlist...not modified
1: WWW-Mechanize-FireFox
use FireFox as if it were WWW::Mechanize
Version: 0.11
Released: 2009-11-26
Author: Max Maischein <corion@cpan.org>
Provide: HTML::Display::MozRepl version 0.11
Provide: HTTP::Cookies::MozRepl version 0.11
Provide: WWW::Mechanize::FireFox version 0.11
Require: HTML::Selector::XPath
Require: HTTP::Response
Require: MIME::Base64
Require: MozRepl::RemoteObject version 0.1 or better
Require: URI
Require: WWW::Mechanize
Require: WWW::Mechanize::Link
Require: parent
Repo: ActiveState Package Repository
CPAN: http://search.cpan.org/dist/WWW-Mechanize-FireFox-0.11/
<tr bgcolor="#ceffce" id="file-1" onmouseover="changeBackgroundColor(1, 0, 0, 1)" onmouseout="changeBackgroundColor(0, 1, 0, 1)" onclick="getFile('cid=504d78064000bf8b7ee14c05027311&lid=15492355');changeBackgroundColor(0, 0, 1, 1)" style="cursor: pointer;">
getfile()
$www->document->getElementById('elementname')->trigger_event('eventhandler')