+ 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 .
33 Respuestas
+ 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
+ 4
Try to search the Code Playground, I recall some people made such wrapper codes before. Try search by 'wiki' terms first ...
+ 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.
+ 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
+ 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
+ 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
+ 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
+ 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.
+ 3
Ipang I know you don't find , I also Google and check on stackoverflow but I don't find
+ 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
+ 3
Check Wikipedia api documentation
+ 3
Response.Redirect with query string and topic as param
....
+ 2
https://code.sololearn.com/WpHpGoB2F8A1/?ref=app
Have a look at this one. :-)
+ 2
Yes it's very informative
+ 1
Arnesh can you please explain with any kind of code
+ 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
+ 1
Calviղ you have give me an json format it is quite useful, but can you explain by a code
+ 1
Try wikit command line tool
+ 1
Calviղ thanks very much