Page MenuHomePhabricator

Add Mediaviews to Pageviews suite
Closed, ResolvedPublic

Description

Context: T116363

Thanks to the kind work of @harej-NIOSH we have an API to fetch media views (e.g. when someone hits play on a page, not just browsing to the File page itself)

API documentation is at P4339

We will adapt the code from Siteviews (the simplest of all the apps) to make a basic timeline-based visualization of the data

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 31 2016, 11:12 PM
MusikAnimal updated the task description. (Show Details)Oct 31 2016, 11:13 PM
MusikAnimal renamed this task from Add Medaiviews to Pageviews suite to Add Mediaviews to Pageviews suite.Nov 1 2016, 12:31 AM
Ainali added a subscriber: Ainali.Nov 4 2016, 11:28 AM

@harej-NIOSH So are we only supporting media that is on Commons? Or is it even possible to generate data on a per-project basis, such as files only available under fair use?

@harej-NIOSH Also, I need either JSONP or CORS support so I can work on this locally :)

@MusikAnimal do we have any fair use sound recordings on Wikipedia? In any case, the code filters out any URL path that isn't /wikipedia/commons and further filters out anything that isn't playable media (i.e. video and sound).

@MusikAnimal do we have any fair use sound recordings on Wikipedia? In any case, the code filters out any URL path that isn't /wikipedia/commons and further filters out anything that isn't playable media (i.e. video and sound).

Fair use audio is common on articles about musicians, etc. I don't know how often people want to know the play counts of such files, but I figure if it's trivial to do we could add support for it. No strong feelings from me, just curious.

The bigger issue as a developer is that I can't query the API from my local machine. I could disable my browser's web security, but obviously that is not ideal :) Otherwise it's a guessing game of writing code, deploying to Tool Labs and hoping it works.

Thanks for your help!

@Harej @harej-NIOSH (sorry don't know which one to ping), I have finally started to work on this. I'm getting around the cross-origin policy by disabling web security in the browser, which isn't ideal, but it works :) So don't worry about adding CORS or JSONP, at least just for me!

Anyway, I noticed there hasn't been any data loaded since 2017-02-05, for instance:
https://tools.wmflabs.org/mediaplaycounts/api/1/FilePlaycount/date_range/How_Wikipedia_contributes_to_free_knowledge.webm/20170125/20170213
https://tools.wmflabs.org/mediaplaycounts/api/1/FilePlaycount/date_range/Donning_PPE-_Engage_Trained_Observer_CDC02.webm/20170201/20170213

Perhaps the API tool need a kick? It appears that the raw data is available.

Also, to be clear, we're only supporting playable audio and video, and not images?

For whatever reason, the cron job I had set up to run the ingest script on a daily basis did not work. So I just run the script every time I need data, based on the last time the report was run. Definitely not ideal.

And yes, this only supports playable audio and video.

Qgil added a subscriber: Qgil.Jun 22 2017, 7:10 AM

I wonder whether features as visible and tangible (and isolated?) as "Views of this media file", "Most viewed media in Commons", "Most viewed media in Category X"... could become good candidates for Possible-Tech-Projects that new developers could dive into.

@Qgil : I think so, and there are already some technical modules which do
the main behaviour here, but aren't integrated into this suite. For
example, https://meta.wikimedia.org/wiki/GLAMorgan

Paputx added a subscriber: Paputx.Jul 12 2017, 6:00 AM

Very interesting: "Views of this media file",

MusikAnimal added a comment.EditedAug 7 2017, 5:25 PM

For those interested some kind developers have put together a tool to grab this data and export as CSV https://tools.wmflabs.org/commons-video-clicks/index.html :)

I still plan on building "Mediaviews" into the Pageviews suite of apps, but there have been some blockers (in my eyes), mainly that the API isn't regularly populated. I also face some UI challenges unique to this effort. Nonetheless with the hackathon around the corner I've decided to give this a go, but it is by no means a competitor to the aforementioned tool :)

Thanks for putting this together, it will be very useful. And I hope the hackathon goes well!

Qgil added a comment.Aug 8 2017, 10:56 AM

@MusikAnimal if you plan to work on this task during the Hackathon (yay!) please add the tag Wikimania-Hackathon-2017.

Restricted Application added a project: Community-Tech. · View Herald TranscriptJan 14 2018, 3:52 AM
MusikAnimal closed this task as Resolved.Jan 24 2018, 12:19 AM
MusikAnimal claimed this task.
MusikAnimal moved this task from In Development to Done on the Tool-Pageviews board.

I'm pleased to announce that I've finally got a basic tool deployed: https://tools.wmflabs.org/mediaviews It only took 15 months =p Sorry for the long wait!

I would consider this beta-ish, so please let me know if you run into any problems.

Categories are still not supported, but they will be soon. For that I've created T185615.

Many thanks Mr Animal, I've added it to the list of GLAMtools here

https://outreach.wikimedia.org/wiki/GLAM/Resources/Tools

Thanks again