Bryant Makes Programs
Bryant Makes Programs

Reputation: 1704

Access Youtube Video URL or ID in MediaWiki API

General Question

What MediaWiki endpoint (through an extension or otherwise) will allow one to get the YouTube URL or video ID for an arbitrary video file (who's provider is 'youtube').

I can find the video length/duration, the video provider, the video's thumbnail, who posted the video, and more; but I can't find the URL for the video (or an identifier to allow me to construct the URL myself)

Below you will find a specific example of a video I'm trying to capture.


Overly Specific Example

I'm trying to find the YouTube video URL or ID for a video using the MediaWiki API.

This is the video:

https://the-handmaids-tale.fandom.com/wiki/File:The_Handmaid%27s_Tale_Season_3_Trailer_(Official)_%E2%80%A2_A_Hulu_Original

So far I've been able to collect from the API that the file is a video and the provider is youtube (via this call: https://the-handmaids-tale.fandom.com/api/v1/Articles/Details?ids=4511). I can't seem to find a call (via the new or old API) that will return the actual video location though.

Thoughts?

Upvotes: 0

Views: 84

Answers (1)

Tgr
Tgr

Reputation: 28200

After a bit of digging, it seems the video ID is exposed as part of the file metadata, so you can construct the URL from there: https://the-handmaids-tale.fandom.com/api.php?action=query&titles=File:The_Handmaid%27s_Tale_Season_3_Trailer_(Official)_%E2%80%A2_A_Hulu_Original&prop=imageinfo&iiprop=metadata

Upvotes: 1

Related Questions