Import of Publish Date, Channel Name, and Title from YouTube URL. Possible?

Hello all,

I am extremely new to Obsidian, Markdown, and PKM, however, I’ve been studying the former for around the last two weeks via podcasts and YT videos. It’s been a bit of an obsession and there seems to be a bit of a learning curve for Obsidian but I am confident it will pay off and I know how to ask for help.

At the moment, I am working on a template for Youtube video input and have adapted it largely from Bryan Jenks. His template for youtube videos can be found here. I am wondering if it is possible to get the Title, Channel/Host, and publish date from the URL and then have it autofill. Perhaps this could also autofill into an iframe that would embed the video. It seemed like Bryan did all of this manually, but, perhaps there is a way to accomplish this that doesn’t require too much coding. Any thoughts?

Super, super easy, thanks to the already existing Youtube oembed endpoint.

The URL to fetch the data from is in this format:

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

And what returns is a nice JSON object of all the video metadata.

```dataviewjs
const data = await requestUrl({ url: 'https://youtube.com/oembed?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ&format=json' })

// Video author's name
dv.paragraph(data.json.author_name)

// Full JSON result
dv.el('pre', JSON.stringify(data.json, null, 2))
```
2 Likes

Woah! Thanks @AlanG ! Just watched a great video on the Dataview plugin so this gives me a chance to see it in action.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.