7

I saw on NoNumber's website, he has a tab which shows reviews from the Joomla Extensions Directory, for example, here

I was wondering, if it's possible to somehow pull reviews from the JED website. I've looked around, but it appears JED don't provide an API, nor can I find anything in the Joomla libraries folder.

I've tried parsing the HTML from a page, however this is overkill and results in very long page loading times.

Does anyone know if this is possible? Would an RSS feed of some sort be more appropriate?

9

There's a JSON undocumented API.

Say your extension has an id of 83 this url will give you the extension and its reviews:

http://extensions.joomla.org/index.php?option=com_jed&view=extension&layout=details&id=83&format=json

If you need jsonp rather than just a simple json output then set format=jsonp.

To work out the extension id you can go to the extensions actual page e.g. http://extensions.joomla.org/extensions/extension/contacts-and-feedback/forms/fabrik, and inspect the the 'write a review' button's href - which looks similar to :

http://extensions.joomla.org/write-review/review/add?extension_id=83

use FOO as your extension id from the segment extension_id=FOO.

Note that rate limiting may be implemented in the future - so best to cache any api call results. Also that JSON Web tokens (http://jwt.io/) may be needed in the future to access the API.

  • Thanks Rob, I'll looks into this too, as it looks promising – Lodder Apr 28 '15 at 6:59
  • I ended up using this method. I wrote an answer below showing how I iterated through the JSON. Thanks again ;) – Lodder Apr 29 '15 at 11:16
5

That's a great idea.

I suppose you could use a tool such as Feed43 to create a 'custom feed'. It's a free online service converts any web page to an RSS feed on the fly. You could then use this feed, and display the results wherever you like.

It works by converting free-form HTML or XML documents to valid RSS feeds by extracting snippets of text or HTML by means of applying search patterns, and then joining these snippets together using output templates to form user-friendly content of feed's items.

Once you have the feed setup it seems quite simple;

  • Your feed reader sends request to our server to download the feed.
  • Feed43, in it's turn, downloads the original source URL, processes it, converts to valid RSS feed on the fly, and returns it to feed reader application.
  • Feed reader displays the contents of this feed to you.

I tried it quickly myself using a random JED extension URL and it does pick up the reviews, even though they are shown in a tab in JED (other free rss creators can't do this).

Play around with it here yourself, I haven't got much time to experiment with it at the minute. The search params threw me off a but I'm sure it just takes a little practice!

Hope this helps.

  • Thanks Johnny. I did as a matter of fact try this before and I too got thrown off by the search patterns. I'll definitely look into this further and see what I can come up with. I do hope JED sort their site's performance out as is seems to be slow slow these days :/ – Lodder Apr 27 '15 at 14:35
5

I ended up going for the JSON method recommended by @Rob Clayburn.

It dumps a massive object with everything there is to know about the extension.

I ended up writing the following to provide me with the review title and main text:

<?php
    $url        = 'http://extensions.joomla.org/index.php?option=com_jed&view=extension&layout=details&id=3711&format=json';
    $contents   = file_get_contents($url);
    $decode     = json_decode($contents, true);
    $reviews    = $decode['reviews'];

    foreach ($reviews as $key => $value) 
    {
        echo $value['core_title']['html'] . "<br>";
        echo $value['core_body']['html'] . "<br>";
    }
?>

You can also replace html with either value or text.

On the new JED, you're able to write something for:

  • Functionality
  • Ease of use
  • Support
  • Documentation

So when you get the results, you may end up with something like this:

{functionality}TEXT_HERE{/functionality}{ease_of_use}TEXT_HERE{/ease_of_use}{support}TEXT_HERE{/support}{documentation}TEXT_HERE{/documentation}

So categorization/separation may be required.

Hope this helps those who want to do the same in future.

I might write a Joomla module so others can integrate it in their own site, without having to worry about code.

4

I coded a module that scrapes the JED site once per day and caches the parsed content using Joomla's cache management system. It was great, as it kept page loads fast. However the JED changed the layout of the site and I just haven't gotten to fixing it.

There are a lot of regressive regular expressions in it, but it can be done. I'd offer you mine but it doesn't work for their new design and layout yet.

  • Ah nice. Were you using a cron job then? – Lodder Apr 27 '15 at 23:28
  • all the reviews etc are using micro data so you could use something like this to scrape the reviews github.com/linclark/MicrodataPHP (but I think the json approach is simpler) – Rob Clayburn Apr 27 '15 at 23:54
  • @Lodder - yes, calling up through the Joomla cli to update the dataset and cache for the day. I also had a query string variable that could force the update (for testing / manual update purposes). – muely2k1 Apr 28 '15 at 18:06
1

Unfortunately there's no rss feed on JED pages :( I suspect they do it manually or maybe they scrape the page. It's a shame because it would be awesome if they could be used for schema.org markup too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.