Page MenuHomePhabricator

Add support for Extension:PageViewInfo
Open, MediumPublicFeature

Description

Feature summary:

Add support for Extension:PageViewInfo

Event Timeline

Xqt triaged this task as Medium priority.Dec 18 2022, 4:12 PM

The interesting thing is not the graph, but the underlying page view numbers.

@Strainu has proposed to use https://www.mediawiki.org/api/rest_v1/ REST API for it. Should we have a new RestAPISite class to implement REST API for Pywikibot?

Let's clarify the terminology and separate the concerns here:

  • I suggested that, based on the usecase, pageview data might be better retrieved from the Wikimedia.org REST API ( https://wikimedia.org/api/rest_v1/#/ ) which is different from the REST API on the other sites (see here). As usual, extensions can add their own endpoints (see for instance /pages/talk at https://en.wikipedia.org/api/rest_v1/ which is missing from MediaWiki Confusing, I know.
  • Pageviews are only part of the Wikimedia API, so it is not exposed through the PageViewInfo extension. From a design point of view, they're totally separated and could potentially return different data at least occasionally (although I suppose they share a common data source)

I think all three are valuable (local API, Wikimedia REST, MediaWiki REST) and should all have wrappers in PWB:

  1. PWB should have a RestAPISite class and potentially subclasses per family (i.e. WikipediaRestApi, CommonsRestApi,WikidataRestApi etc.) + a WikimediaOrgRestApi. Exact naming is TBD, of course.
  2. to expose pageviews data in the Page object the local API should be used, just like it's the case for page_image() or coordinates(). Use of REST API should be at most a backup, but I would personally leave the implementation of the backup mechanism to the bot builders.