Hi,
what you're missing is that you don't have a link to the file on your
page, you are including it as an image
(and it doesn't matter that the file is not actually an image).
Because of that, the file won't show with prop=links, but you can see
it with prop=images
(you can get both at the same time by using prop=links|images).
If you actually wanted to link to that file, write [[:File:Test.txt]]
to your page instead.
Also, I think the last link doesn't do what you think it does:
It links to a page named
www.google.com on your wiki, it doesn't link to Google.
Petr Onderka
[[en:User:Svick]]
On Thu, Jun 7, 2012 at 10:01 AM, volekp <volekp(a)telesun.imag.fr> wrote:
Hi,
I have a problem with MediaWiki API when trying to get links of all files
(images, pdfs, etc ..) which are included in given page. With the MW API I
can get the all other links but no links to media files.
Ex.:
I have a MW with Main Page, which contains following links (all links are
working when click on them):
..
[[File:Test.txt]]
[[Test Page]]
[[
www.google.com]]
..
I use Perl interface to MediaWiki API.
Variable $page contents the hash with properties of 'Main Page'.
my $query = {
action => 'query',
prop => 'links',
titles => $page->{title},
pllimit => 50,
};
my $mw_links = $mediawiki->api($query);
but when I write out the content of
$mw_links->{query}->{pages}->{$page->{pageid}}->{links}, I get only the
titles of the two following links:
Test Page
Www.google.com
I don't get the name of the link to File:Test.txt.
I tried to play also with the namespaces (option plnamespace, for ex.
plnamespace = 6,) but it doesn't show the link neither.
I get the same result when I write it directly to the url:
http://localhost/mediawiki/api.php?action=query&prop=links&pllimit=…
Am I missing something?
Thank you for response.
Pavel Volek
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api