+ 9

How can I fetch data from wikipedia?

I want to fetch data from wikipedia , for eg user give me input "national flower of india" then it search on wikipedia and found one page and returns lotus and its image and when user click on image then it opens wikipedia .

23rd Jul 2020, 7:00 AM
Master Genius [ INACTIVE ]
Master Genius [ INACTIVE ] - avatar
33 Respostas
+ 5
Here a sample of using Wikipedia api to get contents. Wikipedia api https://en.wikipedia.org/w/api.php?action=parse&format=json&page=<search words> https://code.sololearn.com/W0kJA4npmSEF/?ref=app
23rd Jul 2020, 10:19 AM
Calviղ
Calviղ - avatar
+ 4
Try to search the Code Playground, I recall some people made such wrapper codes before. Try search by 'wiki' terms first ...
23rd Jul 2020, 7:40 AM
Ipang
+ 4
Master Genius you have complieted already few tutorials. First you could please try to code and after ask for help. The explanation of Arnesh is enough for the try.
23rd Jul 2020, 8:08 AM
JaScript
JaScript - avatar
+ 3
The first step is getting the url. If there exists an article with the name 'Flowering Plant', it will be in https://en.m.wikipedia.org/wiki/Flowering_plant If not.. Then perhaps you could use the search feature. https://en.m.wikipedia.org/wiki/Special:Search?search=Flowering+Plant From this url, you can get the first search result or something. You need to inspect the link(I am on phone). And get url from the first result. As for getting the pages from the URLs... You can use XMLHttpRequest. See: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
23rd Jul 2020, 7:46 AM
Arnesh
Arnesh - avatar
+ 3
Ipang I don't find any useful code, can you tell any , I got some code which are useful but I also want image of search result
23rd Jul 2020, 7:52 AM
Master Genius [ INACTIVE ]
Master Genius [ INACTIVE ] - avatar
+ 3
Ipang it does not display image in output, I want if I type lotus in input , it search on wikipedia , get image and then display it
23rd Jul 2020, 8:10 AM
Master Genius [ INACTIVE ]
Master Genius [ INACTIVE ] - avatar
+ 3
Ja Play I create a code which is on my old profile , ( I lost email and password of it) which search on wikipedia and tell result, but I want with that result it should display image https://code.sololearn.com/WlA1JzMcqKXS/?ref=app
23rd Jul 2020, 8:13 AM
Master Genius [ INACTIVE ]
Master Genius [ INACTIVE ] - avatar
+ 3
Master Genius I know that, as I said in my previous response, I couldn't find any code that searches and display images from Wikipedia.
23rd Jul 2020, 8:17 AM
Ipang
+ 3
Ipang I know you don't find , I also Google and check on stackoverflow but I don't find
23rd Jul 2020, 8:27 AM
Master Genius [ INACTIVE ]
Master Genius [ INACTIVE ] - avatar
+ 3
https://codepen.io/ayoisaiah/pen/Kzvrbp I found an useful code on wikipedia it , takes input and then search , only thing I want more is to add an image
23rd Jul 2020, 8:35 AM
Master Genius [ INACTIVE ]
Master Genius [ INACTIVE ] - avatar
+ 3
Check Wikipedia api documentation
23rd Jul 2020, 8:39 PM
Bhavya
Bhavya - avatar
+ 3
Response.Redirect with query string and topic as param ....
24th Jul 2020, 4:10 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
23rd Jul 2020, 12:45 PM
Arnesh
Arnesh - avatar
+ 2
Yes it's very informative
24th Jul 2020, 8:49 AM
Hilary Cruz
Hilary Cruz - avatar
+ 1
Arnesh can you please explain with any kind of code
23rd Jul 2020, 7:54 AM
Master Genius [ INACTIVE ]
Master Genius [ INACTIVE ] - avatar
+ 1
Master Genius The image search result from Wikipedia is in particular a challenge. I personally go Google image to search for images. I also searched here, but seems your idea about image was a new idea, I couldn't find any code displaying images linked to Wikipedia either. * This one finds a good candidate for the search term in your original thread above. https://code.sololearn.com/WtBqrgbSzNRn/?ref=app
23rd Jul 2020, 8:03 AM
Ipang
+ 1
Calviղ you have give me an json format it is quite useful, but can you explain by a code
23rd Jul 2020, 8:28 AM
Master Genius [ INACTIVE ]
Master Genius [ INACTIVE ] - avatar
+ 1
Try wikit command line tool
23rd Jul 2020, 9:08 AM
Logomonic Learning
Logomonic Learning - avatar
+ 1
Calviղ thanks very much
23rd Jul 2020, 10:56 AM
Master Genius [ INACTIVE ]
Master Genius [ INACTIVE ] - avatar