On Sun, Jun 10, 2012 at 3:02 AM, Jools Wills <[email protected]> wrote:

> /Logged in with user "WikiAdmin".
>>
>> http://localhost/wiki/images/**archive/0/07/20120609160413%**
>> 21Toilamduoc.png<http://localhost/wiki/images/archive/0/07/20120609160413%21Toilamduoc.png>
>> http://localhost/wiki/images/**0/07/Toilamduoc.png<http://localhost/wiki/images/0/07/Toilamduoc.png>
>> /
>> But now how i can download these files, the method /dowload/ seem to be
>>
>> not able to download the files from the archive?
>>
>
> you can use LWP::UserAgent (as my module does) or WWW:Mechanize which is
> even simpler 
> (http://search.cpan.org/dist/**WWW-Mechanize/<http://search.cpan.org/dist/WWW-Mechanize/>)
> or WWW:Curl
>
> The Download function is for "mediawiki named" files - not the on disk
> filename - it just gets the last file revision.
>
> my download function gets the url for the last image revision and then
>
> $response = LWP::UserAgent->get($url);
> checks the $response->code
>
> and if ok returns the $response->decoded_content;
>
> so you could do the same with the urls. you can even reuse the
> mediawiki::Api objects lwp useragent if you like and do ($mw =
> MediaWiki::API object - configured and ready)
>
> $response = $mw->{ua}->get($url);
> and if ok, open a new file for writing and write the contents out.
>
> some of the modules mentioned earlier (and perhaps even UserAgent) are
> sure to have oneliners for this if you prefer. for large files they might
> be smarter too.
>
> Best Regards
>
> Jools
>
Thank you so much for your help, now i'm able to download all the files
from the archives. i used the LWP::UserAgent as your suggestion
  *      my $ua = LWP::UserAgent->new( timeout => 25 );
        my $response = $ua->get($url);
        if ($response->code) {
                $response = $response->decoded_content;
        }
*
Thuat.

>
> ______________________________**_________________
> Mediawiki-api mailing list
> [email protected].**org <[email protected]>
> https://lists.wikimedia.org/**mailman/listinfo/mediawiki-api<https://lists.wikimedia.org/mailman/listinfo/mediawiki-api>
>
_______________________________________________
Mediawiki-api mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to