There have been some recent additions to the WordPress.org plugin repository. Most notably the changes to the plugin page and the author profile page which now shows an authors favorite plugins.
I want to create a sidebar widget plugin that shows a plugin authors favorites. I know how to use the API to get plugin stats and have also read DD32’s API Docs but I don’t believe docs exist on profiles or if a profile API even exists.
I attempted to use wp_remote_get
and I am able to get the body html from the profile page but haven’t attempted to try and parse it yet as it seems a way to messy way of going about it. It would be great if I could get the profile in XML or json.
Are there any methods that I’m missing or does a profile API exist?
Edit:
Ok I have a beta version up on github using the SimpleHTML Dom parser. I don’t think I will be able to get the star ratings but I’m pretty happy with the results as a first go without an API.
WordPress.org does not allow content scraping and will ban you (via @otto). So this is a no go until a public API is released.
Not yet.
Otto said ‘soon’ on Wednesday. But he went to a BBQ this weekend, so ‘soon’ is probably ‘This month.’ 😉
Edit:
Otto42: @Ipstenu @EricMann I have code to do that, but not deployed yet. Some debate over the best way. It will be there eventually.
The favorited plugins has been added to the WordPress.org API. There is a new feature in 3.5 that allows you to access your favorites from the plugin installer.
See http://core.trac.wordpress.org/ticket/22002 for info on how it is being used in core.
The API allows you to retrieve an object that contains contains each plugins
To retrieve the object
Make a call to http://api.wordpress.org/plugins/info/1.0/ using wp_remote_post passing an array of arguments including the action which would be ‘query_plugins’ and the wp dot org username to retrieve the favorites from.
Before you have a nice clean object you need to do some error handling and other parsing. Here is an example function that will return a nice clean object holding all the plugin details.
Usage
This example usage will give you an unordered list of favorite plugins along with a link to the plugin on dot org, a link to the author uri and the star rating.
Result
Widget screenshot from my Favorite Plugins Widget plugin:
http://wordpress.org/extend/plugins/favorite-plugins-widget/