Link to home
Start Free TrialLog in
Avatar of Ray Paseur
Ray PaseurFlag for United States of America

asked on

Popular MediaWiki Extensions

Please forgive me if this is a novice question - I'm a neophyte when it comes to MediaWiki.

I'm looking for Video extensions to add to a MediaWiki project.  Some are probably popular and some are arcane.  For obvious reasons I would like to choose an extension that lots of other Wikis also use.  Examples here:
https://www.mediawiki.org/wiki/Category:Video_player_extensions

If this were a WordPress project, I would be able to see the popularity of plug-ins here:
https://wordpress.org/plugins/browse/popular/

Is there a way to find the popularity of MediaWiki extensions?  I've found lots "top-ten" lists, but I'd rather just get straight to the number of Wiki installations that use a given extension.

Thanks and regards,
Ray
Avatar of gheist
gheist
Flag of Belgium image

Typically these: https://www.mediawiki.org/wiki/Category:Extensions_used_on_Wikimedia get slowly integrated in new base release.
ASKER CERTIFIED SOLUTION
Avatar of skij
skij
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ray Paseur

ASKER

@skij: Very helpful!

Output:
Extension:TimedMediaHandler       2,106
Extension:EmbedVideo              1,735
Extension:Widgets                 1,542
Extension:HTML5video                561
Extension:MediawikiPlayer           433
Extension:OggHandler                284
Extension:VideoFlash                248
Extension:Html5mediator             245
Extension:Player                    217
Extension:WidgetsFramework          136
Extension:Mp3                       129
Extension:FramedVideo               126
Extension:FlvHandler                106
Extension:FLVPlayer                 106
Extension:YouTubeTag                 97
Extension:MultimediaPlayer           93
Extension:Quicktime                  89
Extension:GoogleVideo                58
Extension:OFlash                     54
Extension:InteriaVideo               48
Extension:FLVPlayerTwo               43
Extension:SuperDeluxe                36
Extension:Vine                       27
Extension:VPIPPlugin                 25
Extension:Stage6                     22
Extension:YouTube+(emijrp)            0

Open in new window

Script:
<?php // demo/mwcounts.php
/**
 * Get MediaWiki page statistics summary
 *
 * http://www.experts-exchange.com/questions/28790419/Popular-MediaWiki-Extensions.html#a41166145
 */
error_reporting(E_ALL);
echo '<pre>';

$base  = 'http://stats.grok.se/json/www.w/latest30/';
$pages = array
( 'Extension:EmbedVideo'
, 'Extension:FlvHandler'
, 'Extension:FLVPlayer'
, 'Extension:FLVPlayerTwo'
, 'Extension:FramedVideo'
, 'Extension:GoogleVideo'
, 'Extension:Html5mediator'
, 'Extension:HTML5video'
, 'Extension:InteriaVideo'
, 'Extension:MediawikiPlayer'
, 'Extension:Mp3'
, 'Extension:MultimediaPlayer'
, 'Extension:OFlash'
, 'Extension:OggHandler'
, 'Extension:Player'
, 'Extension:Quicktime'
, 'Extension:Stage6'
, 'Extension:SuperDeluxe'
, 'Extension:TimedMediaHandler'
, 'Extension:TimedMediaHandler/ogv.js'
, 'Extension:VideoFlash'
, 'Extension:Vine'
, 'Extension:VPIPPlugin'
, 'Extension:Widgets'
, 'Extension:WidgetsFramework'
, 'Extension:YouTube (emijrp)'
, 'Extension:YouTubeTag'
)
;
$out = [];
foreach ($pages as $page)
{
    $url = $base . urlencode($page);
    $jso = file_get_contents($url);
    if (!$jso) continue;
    $obj = json_decode($jso);
    if (!$obj) continue;

    $views = array_sum( (array)$obj->daily_views );
    $views = number_format($views);
    $views = str_pad($views, 7, ' ', STR_PAD_LEFT);

    $title = $obj->title;
    $title = str_pad($title, 32, ' ', STR_PAD_RIGHT);

    $out[$title] = $views;
}
arsort($out);

foreach ($out as $title => $views)
{
    echo PHP_EOL;
    echo $title;
    echo $views;
}

Open in new window

Very practical way of finding a good answer!
I had a feeling you were going to make a script for this!  However, there are two problems with your code.

Firstly, one result is completely missing.  Notice that you have 27 $pages in your array but only 26 items are returned.  "Extension:TimedMediaHandler/ogv.js" is missing.

Secondly, your result for "Extension:YouTube+(emijrp)" is erroneously 0.

I recommend getting the links dynamically to prevent the risk of problems caused by typos and also to provide forward support as new extensions are added.

I modified your code, and it now returns better results.
<?php
/**
 * Get MediaWiki page statistics summary
 *
 * http://www.experts-exchange.com/questions/28790419/Popular-MediaWiki-Extensions.html#a41168469
 */

error_reporting(E_ALL);
set_time_limit(0);
 
header("Content-Type: text/plain"); 

$data= file_get_contents('https://www.mediawiki.org/wiki/Category:Video_player_extensions');
preg_match_all('#\/Extension\:[^"]+#', $data, $pages);
$base  = 'http://stats.grok.se/json/www.w/latest30/';

$padTitle = max(array_map('strlen', $pages[0]))+2;

$out = array();

foreach ($pages[0] as $page)
{
    $url = $base . $page;
    $jso = file_get_contents($url);
    if (!$jso) continue;
    $obj = json_decode($jso);
    if (!$obj) continue;

    $views = array_sum( (array)$obj->daily_views );
    $views = number_format($views);
    $title = $obj->title;
    $out[$title] = intval(str_replace(',', '', $views));
}
arsort($out);

$padViews = max(array_map('strlen', $out));

foreach ($out as $title => $views)
{
    echo str_pad($title, $padTitle, ' ', STR_PAD_RIGHT);
    echo str_pad($views, $padViews, ' ', STR_PAD_LEFT);
    echo PHP_EOL;
}

exit;

?>

Open in new window

PS... I feel like I just coached Magic Johnson how how to play basketball.
This is probably a better and more generalized solution, thanks.
Here is another helpful resource: The WikiApiary.
https://wikiapiary.com/wiki/Extension:Extensions