On Fri, Jun 8, 2012 at 8:27 PM, Jools Wills <[email protected]> wrote:
> On 07/06/12 17:07, nguyenkim thuat wrote: > > When I tried to call this function for example with filename >> *'20120606205541!Test.txt'* which is located in directory >> >> images/archive/ I got empty result. According to the documentation of >> the download function, it means the file doesn't exist on the MediaWiki. >> */"If the file does not exist (on the wiki) an empty string is returned. >> If the file is unable to be downloaded undef is returned./*" >> > > the "name" is the name in the wiki - ie File:Something.jpg - not the on > disk name. the download call was a shortcut to get the last version only. > > Read the API documentation here - > http://www.mediawiki.org/wiki/**APIin<http://www.mediawiki.org/wiki/APIin>this > case you can use imageinfo. > > http://en.wikipedia.org/w/api.**php?action=query&titles=Image:** > Albert%20Einstein%20Head.jpg&**prop=imageinfo&iilimit=4&**iiprop=url<http://en.wikipedia.org/w/api.php?action=query&titles=Image:Albert%20Einstein%20Head.jpg&prop=imageinfo&iilimit=4&iiprop=url> > > Thanks you so much, now i have all the urls of a file from my wiki using this method. sub getFileArchive { mw_connect_maybe(); my $filename = shift; my $query = { action => 'query', prop => 'imageinfo', titles => $filename, iilimit => 4, iiprop => 'url', }; my $result = $mediawiki->api($query); my ($pageID,$page) = each (%{$result->{query}->{pages}}); if (defined($page->{imageinfo})) { while (my $urlFile = pop(@{$page->{imageinfo}})) { my $host = $urlFile->{url}; print "$host\n"; } } } *Logged in with user "WikiAdmin". http://localhost/wiki/images/archive/0/07/20120609160413%21Toilamduoc.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? Thanks. > ______________________________**_________________ > 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
