<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d8211560\x26blogName\x3dTech+Tips,+Tricks+%26+Trivia\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://mvark.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttp://mvark.blogspot.com/\x26vt\x3d601588505461698440', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Tech Tips, Tricks & Trivia

by 'Anil' Radhakrishna
An architect's notes, experiments, discoveries and annotated bookmarks.

Search from over a hundred HOW TO articles, Tips and Tricks

HOW TO extract Wikipedia content through its API using jQuery

Wikipedia's API or more appropriately MediaWiki API,  lets you programmatically fetch content & metadata related to thousands of its articles.

I built a small custom Wikipedia search application - Q-Wikipedia, to get just the first paragraph of a Wikipedia article using jQuery with help from online resources.

The REST-based Wikipedia API has many configurable options. It's easy to select the options you require using the Wikipedia API Sandbox

As I need only the first paragraph I set the value of the sections parameter to 0 (default is all)

&format=json&page="+ keyword + "

It has auto-completion of search terms, which was a breeze to implement using jQueryUI.

Super-script and a few other tags are removed from the Wikipedia content derived from the JSONP payload prior to injecting it into a DIV placeholder -


Try it out and let me know your feedback by posting a comment below.

Labels: , ,

Tweet this | Google+ it | Share on FB

« Home | Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »

Posted by Blogger onlinearticles | 6/09/2013 03:36:00 PM

will you please provide the full source code for this...

thanks . for sharing..    

Posted by Blogger Anil | 6/09/2013 04:03:00 PM

The JavaScript code to access the Wikipedia API is right in the HTML page source. Right click on the page & choose View Page Source to go through it.    


Post a Comment