gpt4 book ai didi

javascript - 订阅youtube js

转载 作者:行者123 更新时间:2023-12-03 06:20:31 25 4
gpt4 key购买 nike

我想知道如何检测某个人是否在我的YouTube channel 中输入。如果是我释放阅读内容,则需要注册。

我尝试使用youtube按钮,但是它不起作用,单击时从不返回任何值。

<script src="https://apis.google.com/js/platform.js"></script>

<script>
function onYtEvent(payload) {
if (payload.eventType == 'subscribe') {
alert('Yes')
// Add code to handle subscribe event.
} else if (payload.eventType == 'unsubscribe') {
alert('no')
// Add code to handle unsubscribe event.
}
if (window.console) { // for debugging only
window.console.log('YT event: ', payload);
}
}
</script>

<div class="g-ytsubscribe" data-channelid="UCMuP3q3YcWziAcqZA" data-layout="default" data-count="default" data-onytevent="onYtEvent"></div>

我想知道进入页面,或者我没有在 channel 中注册。类似于社交储物柜。

最佳答案

不幸的是,Youtube已弃用该功能。

Note: The Subscribe Button's subscribe and unsubscribe events have been deprecated. Similarly, the data-ytonevent attribute, which could previously be added to the widget element to specify a listener for event notifications, has also been deprecated.



引用- https://developers.google.com/youtube/subscribe/reference

关于javascript - 订阅youtube js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36070362/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com