Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search for text in page title and content with MediaWiki API?

I'm not sure if it is actually possible to do, because I can only find out how to search titles like this:

/api.php?action=query&rvlimit=10&rvprop=content&format=xml&titles=searchterm
like image 640
Gil Julio Avatar asked Jan 28 '26 10:01

Gil Julio


1 Answers

To search for 10 pages that contain the word 'wikipedia'

api.php ? action=query & list=search & srsearch=wikipedia & srprop=timestamp

and the result is

<?xml version="1.0"?>
<api>
  <query>
    <searchinfo totalhits="40085" />
    <search>
      <p ns="0" title="Wikipedia" timestamp="2011-02-26T16:43:03Z" />
      <p ns="0" title="French Wikipedia" timestamp="2011-02-27T00:11:59Z" />
      <p ns="0" title="Main Page" timestamp="2011-01-19T19:49:11Z" />
      <p ns="0" title="Regent" timestamp="2011-02-24T03:45:02Z" />
      <p ns="0" title="Blocking of Wikipedia by the People&#039;s Republic of China" timestamp="2011-02-25T03:12:52Z" />
      <p ns="0" title="Nemzeti Bajnokság I" timestamp="2011-02-02T23:27:44Z" />
      <p ns="0" title="Teller–Ulam design" timestamp="2011-02-06T21:54:56Z" />
      <p ns="0" title="Norwegian Wikipedia" timestamp="2011-01-06T18:43:32Z" />
      <p ns="0" title="List of countries and outlying territories by total area" timestamp="2011-02-26T17:31:44Z" />
      <p ns="0" title="2009–2010 ISU Junior Grand Prix" timestamp="2011-02-19T04:24:52Z" />
    </search>
  </query>
  <query-continue>
    <search sroffset="10" />
  </query-continue>
</api>

More here

like image 92
nischayn22 Avatar answered Jan 31 '26 01:01

nischayn22