Page MenuHomePhabricator

Get URL of actual pronunciation audio file instead of File page
Closed, ResolvedPublic

Description

Example (title pronunciation for Neptune): https://en.wikipedia.org/api/rest_v1/page/mobile-html-sections-lead/Neptune

Parsoid https://en.wikipedia.org/api/rest_v1/page/html/Neptune gives us:

<span typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;Listen&quot;}"><a href="//upload.wikimedia.org/wikipedia/commons/f/f3/En-us-Neptune.ogg"><img resource="./File:Speakerlink-new.svg" src="//upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Speakerlink-new.svg/11px-Speakerlink-new.svg.png" data-file-width="11" data-file-height="11" data-file-type="drawing" height="11" width="11"></a></span>

Ideas:

  1. We could look for the first occurrence of <span typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;Listen&quot;}">.

A selector like 'span[typeof*=Image][data-mw*=caption][data-mw*=Listen] a' should work. I ran into issues getting a selector for the exact strings of these attributes. If anyone knows how, please let me know.

  1. Make an extra request to MW API https://en.wikipedia.org/w/api.php?action=query&prop=imageinfo&format=json&iiprop=url&titles=File%3AEn-us-Neptune.ogg

Event Timeline

bearND created this task.Nov 6 2015, 5:21 AM
bearND raised the priority of this task from to High.
bearND updated the task description. (Show Details)
bearND added a project: Mobile-Content-Service.
bearND moved this task to Backlog on the Mobile-Content-Service board.
bearND added a subscriber: bearND.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 6 2015, 5:21 AM
bearND set Security to None.
bearND moved this task from Backlog to Doing on the Mobile-Content-Service board.

Change 252448 had a related patch set uploaded (by Niedzielski):
Use pronunciation file URL instead of page URL

https://gerrit.wikimedia.org/r/252448

Change 252448 merged by jenkins-bot:
Use pronunciation file URL instead of page URL

https://gerrit.wikimedia.org/r/252448

@Niedzielski I noticed after merging that this doesn't get title pronunciations in all cases.
See http://localhost:6927/en.wikipedia.org/v1/page/mobile-html-sections-lead/Oxford as an example.

In general I find this list useful for testing: https://en.wikipedia.org/wiki/Category:Articles_including_recorded_pronunciations

@bearND, the pronunciation icon only shows for articles that have an audio file. I don't see one for Oxford.

My bad. You are correct. I'm moving it back to ready for sign off.

bearND moved this task from Code Review to To Deploy on the Mobile-Content-Service board.
bearND closed this task as Resolved.Nov 18 2015, 6:43 PM