Fetch any YouTube video’s metadata in 2 lines

Photo by Alexander Shatov on Unsplash

So, i was looking for a way to quickly get a YouTube video’s metadata without having to setup the developer account and get an API key since i just needed to integrate it as one small feature.

After doing a quick Google search, I came across the oembed API to fetch metadata for any video with using its link. So it goes like dis

tldr:

(• ◡ •)/

But after a bit of refactoring 🧹…

\(• ◡ •)/

The basic HTTP request looks like this…

http://youtube.com/oembed?url=${YOUR_VIDEO_URL}&format=json

Gives us a response like this…

{
"title": "Rick Astley - Never Gonna Give You Up (Video)",
"author_name": "RickAstleyVEVO",
"author_url": "https://www.youtube.com/user/RickAstleyVEVO",
"type": "video",
"height": 113,
"width": 200,
"version": "1.0",
"provider_name": "YouTube",
"provider_url": "https://www.youtube.com/",
"thumbnail_height": 360,
"thumbnail_width": 480,
"thumbnail_url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
"html": "<iframe width=\"200\" height=\"113\" src=\"https://www.youtube.com/embed/dQw4w9WgXcQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
}

That’s pretty neat :]

--

--

--

onw to 10x developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Semantic Web History & Tools to use, to “Naturalise the Web”

Canary Deployment Using Istio on EKS Cluster || Istio || Kiali || Grafana

High-performance Computing on AWS: Choosing the Perfect Data Storage Service for Your HPC Workloads

InsureDAO InsureDAO is a peer to pool insurance market protocol on Ethereum.

Week 6+7

One example on: How to increment Scrum Mindset?

The Big O

Beginning with GitHub

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Navin Kodag

Navin Kodag

onw to 10x developer

More from Medium

How to add comments to your blog ?

Top 10 Reasons Why Angular Technology has proved best for eCommerce Portal Development

Products with no img — JavaScript + API RESTful (WordPress)

Hot-swapping the Web API for mobile application