Re: Macros for Firefox on Fedora Core 5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 21 July 2006 12:28, Erich Carlson wrote:
> I'm looking for a method to record keystrokes to create macros to access
> a web page, enter the login info, download a file from the web page,
> etc.
>
> Does anyone have an easy way to do this?

Not exactly a Fedora thing. I have no idea how to do this in firefox For what 
it is worth, you might try perl and WWW:Mechanize. It is very easy to do what 
you want as long as the page is primarily static. WWW::Mechanize has no 
javascript interpreter and I don't know how to get around that. Anyway, here 
is a download files example from the WWW:Mechanize CPAN page with userID and 
passWord added in. This one looks for all the mp3 links on a page and grabs 
them. At least is should. I have not tested it at all. 

#!/usr/bin/perl -w

use strict;
use WWW::Mechanize;

## Create our username and password variables
my $user_id = "mp3guy";
my $user_pw = "g3tmyf!l3s";


my $start = "https://www.somecrazyexample.site/login.html";;
my $filePage = "https://www.somecrazyexample.site/all-the-mp3s-on-earth.html";;

my $mech = WWW::Mechanize->new( autocheck => 1 );
$mech->get( $start );

# submit the login form. Assumes the fields are 'uname' and 'passwd' 
$mech->submit_form(
   fields => {
       uname    => $user_id,
       passwd => $user_pw,
   }
);

# you should check to see if this worked somehow but for our example on we go.
$mech->get( $filePage );

my @links = $mech->find_all_links( url_regex => qr/\d+.+\.mp3$/ );

for my $link ( @links ) {
  my $url = $link->url_abs;
  my $filename = $url;
  $filename =~ s[^.+/][];

  print "Fetching $url";
  $mech->get( $url, ':content_file' => $filename );

  print "   ", -s $filename, " bytes\n";
}

-- 
Life would be much easier if I had the source code. - unknown


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux