Last modified: 2013-10-15 15:36:58 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57622, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55622 - API doesn't expose transcoded media URLs
API doesn't expose transcoded media URLs
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
TimedMediaHandler (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Michael Dale
https://commons.wikimedia.org/w/api.p...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-11 14:00 UTC by Brion Vibber
Modified: 2013-10-15 15:36 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Brion Vibber 2013-10-11 14:00:12 UTC
I notice that there doesn't seem to be a way in the API data for transcode status or imageinfo to get the actual URLs of transcoded media output.


prop=transcodestatus lists the formats/sizes but doesn't expose URLs to the actual resources:

https://commons.wikimedia.org/w/api.php?action=query&prop=transcodestatus&titles=File:Malta%20-%20Mellieha%20-%20Misrah%20iz-Zjara%20tal-Papa%20Gwanni%20Pawlu%20II%2001%20%280%29%20ies.ogv&format=jsonfm


prop=imageinfo&iiprop=url|size lists the URL to the original media file, but none of the transcodes:

https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&titles=File:Malta%20-%20Mellieha%20-%20Misrah%20iz-Zjara%20tal-Papa%20Gwanni%20Pawlu%20II%2001%20%280%29%20ies.ogv&format=jsonfm&iiprop=url|size


For lower-level tools doing a preview, or native app playback, it would be very nice to have direct access to the transcodes. (I can probably fake the URLs by knowing what they happen to be relative to the base media file, but I don't know if that's stable.)
Comment 1 Brion Vibber 2013-10-14 15:52:40 UTC
Here's the workaround I'm using in ogv.js demo to take the original-media URL, a known height & format, and return the URL to the transcode:

	function transcodeUrl(url, height, format) {
		var matches = url.match(/^(.*)\/(.\/..)\/(.*?)$/),
			baseUrl = matches[1],
			hash = matches[2],
			filename = matches[3];
		return baseUrl + '/transcoded/' + hash + '/' + filename + '/' + filename + '.' + height + 'p.' + format;
	}
Comment 2 Bawolff (Brian Wolff) 2013-10-14 17:40:18 UTC
Ignoring that its kind of broken (integer keys not allowed in xml format), not properly documented, and imo a confusing way to extend an api module, I believe you can get that info via: http://commons.wikimedia.org/w/api.php?action=query&titles=File:Folgers.ogv&prop=videoinfo&viprop=derivatives&format=jsonfm
Comment 3 Brion Vibber 2013-10-15 15:36:58 UTC
Oh yay! Lemme close this out as WORKSFORME then.... but I'll file some bugs on that, there's some inconsistencies in the output. :D

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links