如何嵌入我最近在 YouTube 上分享的视频?

发布于 2024-12-03 12:17:03 字数 636 浏览 3 评论 0 原文

尝试阅读有关在我的网站上嵌入视频的官方指南网站,但我没有找到教如何嵌入我的 YouTube 区域上加载的最后一个视频的部分。

可以吗(使用JS API)?

编辑 回调以检查视频并执行一些操作,

<head>
    <script type="text/javascript" src="http://gdata.youtube.com/feeds/users/MyNickname/uploads?alt=json-in-script&format=5&callback=showMyVideos"></script>

    <script type="text/javascript">
        function showMyVideos(data) {
            alert("Hello");
        }
    </script>         
</head>

这应该显示我的警报,但没有任何反应。为什么=

Tried to read the official guide about embedding video on my website, but I don't find the part which teach how to embed the last video loaded on my youtube zone.

Is it possible (using JS API)?

EDIT Callback for check a video and do some things

<head>
    <script type="text/javascript" src="http://gdata.youtube.com/feeds/users/MyNickname/uploads?alt=json-in-script&format=5&callback=showMyVideos"></script>

    <script type="text/javascript">
        function showMyVideos(data) {
            alert("Hello");
        }
    </script>         
</head>

this should show my alert, but nothing happens. Why=

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

彡翼 2024-12-10 12:17:03

您可以使用以下 URL 获取特定用户上传的 JSON 格式的视频列表。

http://gdata.youtube.com/feeds/users/GoogleDevelopers/uploads?alt=json

注意:alt=json 并将 GoogleDevelopers 替换为您的用户。

您可以使用 jQuery.ajax() 从 URL 获取数据,然后获取第一个饲料(最新的)

You could use the following URL to get the list of uploaded video by particular user in JSON format.

http://gdata.youtube.com/feeds/users/GoogleDevelopers/uploads?alt=json

Note : alt=json and to replace GoogleDevelopers with your user.

You could use jQuery.ajax() to get the data from the URL then just get the first feed (the latest one)

缘字诀 2024-12-10 12:17:03

您需要使用YT Data API 的这一部分 。返回的视频的顺序是最近上传的,因此您可以从返回的列表中获取第一个。

例如:

https://gdata.youtube.com/feeds/api/users/SocialGo/uploads?alt=json&fields=entry/id,entry/published

You'll want to use this section of the YT Data API. The order of returned videos is most recently uploaded first, so you can just grab the first off the returned list.

For example:

https://gdata.youtube.com/feeds/api/users/SocialGo/uploads?alt=json&fields=entry/id,entry/published

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文