Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Wikipedia API to get the page view statistics of a particular page in wikipedia?

Tags:

The stats.grok.se tool provides the pageview statistics of a particular page in wikipedia. Is there a method to use the wikipedia api to get the same information? What does the page views counter property actually mean?

like image 655
lipid Avatar asked Mar 16 '11 09:03

lipid


People also ask

How do I see how many views a Wikipedia page has?

The pageview stats tool is available from any page, in two ways: 1) Click "Page information" under "Tools" in the sidebar and then "Page view statistics" at the bottom. 2) Click the history tab and then "Pageviews" near the top.

Does Wikipedia have a free API?

A web-based free encyclopedia, Wikipedia is available in many languages and is among the top 5 websites on the internet. The largest general reference body of work on the internet, its uses in applications offer countless possibilities.

Can I use Wikipedia API?

Using the Wikipedia API. Let's say that you wanted your web application to pull in data from a source like Wikipedia. With an API, we can programatically pull the information right from Wikipedia, and format it to fit our project, app, or website nicely - only showing the information that we want.


1 Answers

The Pageview API was released a few days ago: https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/{project}/{access}/{agent}/{article}/{granularity}/{start}/{end}

  • https://wikimedia.org/api/rest_v1/?doc#/
  • https://wikitech.wikimedia.org/wiki/Analytics/AQS/Pageview_API

For example https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia/all-access/all-agents/Foo/daily/20151010/20151012 will give you

{
  "items": [
    {
      "project": "en.wikipedia",
      "article": "Foo",
      "granularity": "daily",
      "timestamp": "2015101000",
      "access": "all-access",
      "agent": "all-agents",
      "views": 79
    },
    {
      "project": "en.wikipedia",
      "article": "Foo",
      "granularity": "daily",
      "timestamp": "2015101100",
      "access": "all-access",
      "agent": "all-agents",
      "views": 81
    }
  ]
}
like image 122
Tgr Avatar answered Oct 12 '22 15:10

Tgr