Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add getImagesFromArticle() method
  • Loading branch information
macbre committed Mar 3, 2013
1 parent 5362ca3 commit 010de68
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -133,6 +133,10 @@ Gets list of all images on a wiki

Gets list of all articles using given image

## bot.getImagesFromArticle(title, callback)

Get list of all images that are used on a given page - [read more](http://www.mediawiki.org/wiki/API:Properties#images_.2F_im)

### bot.getImageInfo(filename, callback)

Gets metadata (including uploader, size, dimensions and EXIF data) of given image
Expand Down
11 changes: 11 additions & 0 deletions lib/bot.js
Expand Up @@ -331,6 +331,17 @@
});
},

getImagesFromArticle: function(title, callback) {
this.api.call({
action: 'query',
prop: 'images',
titles: title
}, function(data) {
var page = getFirstItem(data && data.pages || []);
callback && callback((page && page.images) || []);
});
},

getImageUsage: function(filename, callback) {
this.api.call({
action: 'query',
Expand Down

0 comments on commit 010de68

Please sign in to comment.