YouTube是一个视频共享网站,用户可以在该网站上传,分享和观看视频。标有“youtube”的StackOverflow问题应该与特定的编程问题,软件工具或库有关。如果您的问题与YouTube API有关,则还应添加“youtube-api”标记。
是否可以从我的频道获取最新的 YouTube 视频缩略图?我只想在我的网站上显示 5 个最新的 YouTube 视频缩略图,然后在单击时在弹出窗口中播放该视频。 S...
我正在尝试使用标准 YouTube URL 以编程方式生成 YouTube 嵌入 URL。我在生成可剪辑的嵌入 URL 时遇到问题。谷歌的文档中没有列出 Clipt 参数...
我正在编写一个网站,作为我所有内容(博客文章、YouTube 视频等)的集合,并希望有一个 YouTube 嵌入页面。我想要两列嵌入,但不知道如何做。我...
我一直在尝试使用 YouTube 实时聊天 API 来渲染 YouTube 实时流聊天,但我对如何处理表情感到困惑。 用于实时聊天消息的 YouTube API 似乎只适用于...
osx - 使用 mpv 或 mplayer 与 libcaca 或 aalib 在终端中以文本形式播放 YouTube 视频?
我通过自制程序安装: 酿造安装mplayer mpv libcaca aalib 尝试在我的终端中以文本形式播放视频。使用 mplayer,我尝试了 aa: youtube-dl https://www.youtube.com/watch?v=urxk4mveLCw -...
有没有办法在 youtube iframe api 中更改音频语言?
有更改音频语言的参数吗? 我想更改音频语言,例如 cc_lang_pref = "ko" 但没有像audio_lang_pref这样的参数名称。 有没有办法改变音频语言...
代码: 从 pytube 导入播放列表 播放列表 = 播放列表('https://www.youtube.com/playlist?list=PLWPirh4EWFpEpO6NjjWLbKSCb-wx3hMql') 对于 playlist.videos 中的视频: 打印(“视频:”,视频)...
我想知道是否有办法通过 youtube 数据 api、分析 api 或任何其他 api 告诉我视频是否为 youtube 原创? 我查看了数据 api 和分析 api 文档...
Angular Youtube 播放器 - 适合 100% 高度
我在 Angular 11 项目中使用 Youtube Angular pakacge。我想将播放器填充到 div 高度的 100%,这是一个 TailWind h-full div: 我在我的 Angular 11 项目中使用 Youtube Angular pakacge。我想将播放器填充到 div 高度的 100%,这是一个 TailWind h-full div: <div class="flex flex-col flex-auto w-full h-full xs:p-2" #videoContainer> <youtube-player *ngIf="videoId" [videoId]="videoId" width="100%" [height]="videoHeight" ></youtube-player> </div> 我已经尝试用两种不同的方式做到这一点: #1 height="100%" 或 height="100vh" 两者都会导致: #2 动态高度 [height]="videoHeight" ngOnInit() { this._params = this._route.params.subscribe((params) => { this.videoId = params['videoId']; }); } ngAfterViewInit(): void { this.videoHeight = this.videoContainer.nativeElement.offsetHeight; } 这有效,但会导致 错误:NG0100:ExpressionChangedAfterItHasBeenCheckedError:表达式在检查后已更改。先前值:“未定义”。当前值:'905'.. #3 移动videoHeight 我将 this.videoHeight = this.videoContainer.nativeElement.offsetHeight; 移至构造函数,在 OnInit 中,这导致: TypeError:无法在新的 YoutubeComponent 处读取未定义的属性“nativeElement” 我做错了什么? 这是我解决问题的方法, 我创建了新组件: ng g component components/yt-player 在 yt-player.component.html 添加带有 ref 和 youtube-player 的容器 <div #youTubePlayer > <youtube-player [width]="videoWidth" [height]="videoHeight" [videoId]="videoID"></youtube-player> </div> 并在yt-player.component.ts中添加以下代码: export class YtPlayerComponent implements AfterViewInit { @ViewChild('youTubePlayer') youTubePlayer: ElementRef<HTMLDivElement>; videoHeight: number | undefined; videoWidth: number | undefined; @Input('videoID') videoID: string; constructor(private changeDetectorRef: ChangeDetectorRef) {} ngAfterViewInit(): void { this.onResize(); window.addEventListener('resize', this.onResize.bind(this)); } onResize(): void { // you can remove this line if you want to have wider video player than 1200px this.videoWidth = Math.min( this.youTubePlayer.nativeElement.clientWidth, 1200 ); // so you keep the ratio this.videoHeight = this.videoWidth * 0.6; this.changeDetectorRef.detectChanges(); } } 代码基本上是不言自明的,您可以参考 youtube-player 的容器,在 afterViewInit 中设置 videoHeight 和 videoWidth ,以对应容器的宽度。我们设置事件监听器在尺寸改变的情况下更新宽度和高度。最后我们添加 @Input('videoID') videoID: string 这样我们就可以将 id 传递给 youtube-player 组件。所以我们可以这样使用它: <yt-player videoID="oHg5SJYRHA0"></yt-player> 尝试height="100vh" 尝试在声明期间或在 videoHeight 中为 constructor 赋值 或在 ngOnInit 挂钩中。 <youtube-player [videoId]="videoId" [width]="screenWidth" [height]="screenHeight" ></youtube-player> import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-your-component', templateUrl: 'your-component.page.html', styleUrls: ['your-component.page.scss'], }) export class YourComponent implements OnInit { screenWidth: number; screenHeight: number; ngOnInit() { this.screenWidth = window.innerWidth; this.screenHeight = window.innerHeight * 0.3; // 30% of the viewport height } } 删除模板代码中设置 width 和 height 的任何尝试 - <div class="flex flex-col flex-auto w-full h-full xs:p-2"> <youtube-player *ngIf="videoId" [videoId]="videoId"></youtube-player> </div> 也来自组件代码。然后它应该自动显示为全高。
我有这段代码,它工作得很好。 if( strcasecmp( 'www.youtube.com/watch', $link[2] ) == 0 && $this->params( $params, $link[3], 'v' ) ) 返回' <p>我有这个代码,它工作得很好。</p> <pre><code>if( strcasecmp( 'www.youtube.com/watch', $link[2] ) == 0 && $this->params( $params, $link[3], 'v' ) ) return '<iframe width="'.$width.'" height="'.$height.'" src="'.$link[1].'www.youtube.com/embed/'.$params['v'].'?rel=0&amp;playsinline=1&amp;controls=1&amp;showinfo=0&amp;modestbranding=0" frameborder="0" allowfullscreen></iframe>'; else if( preg_match( '/^(?:www\.)?youtu\.be\/([^\/]+)/i', $link[2], $matches )) return '<iframe width="'.$width.'" height="'.$height.'" src="'.$link[1].'www.youtube.com/embed/'.$matches[1].'?rel=0&amp;playsinline=1&amp;controls=1&amp;showinfo=0&amp;modestbranding=0" frameborder="0" allowfullscreen></iframe>'; </code></pre> <p>它工作得很好,可以自动用视频替换链接。但现在,YouTube 有这样的东西,短视频有一个“Shorts”的链接</p> <p>示例:<a href="https://youtube.com/shorts/d1wXX9xO_2o?feature=share" rel="nofollow noreferrer">https://youtube.com/shorts/d1wXX9xO_2o?feature=share</a></p> <p>这不会自动嵌入。知道如何解决这个问题吗?</p> <p>我已经尝试过:</p> <pre><code>else if( preg_match( '/^(?:www\.)?youtube\.com/shorts\/([^\/]+)/i', $link[2], $matches )) return '<iframe width="'.$width.'" height="'.$height.'" src="'.$link[1].'www.youtube.com/embed/'.$matches[1].'?rel=0&amp;playsinline=1&amp;controls=1&amp;showinfo=0&amp;modestbranding=0" frameborder="0" allowfullscreen></iframe>'; </code></pre> <p>但运气不佳。</p> </question> <answer tick="false" vote="4"> <p>您不需要为短裤使用不同的代码,只需使用其网址末尾的标识符和此 iframe:</p> <pre><code><iframe width="720" height="576" src="{{'https://www.youtube.com/embed/' . $video}}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe> </code></pre> <p>经过测试,它非常适合我。</p> </answer> <answer tick="true" vote="1"> <p>这有效。</p> <pre><code>else if( preg_match( '/youtube\.com\/shorts\/(\w+\s*\/?)*([0-9]+)*$/i', $link[2], $matches ) ) return '<iframe width="'.$width.'" height="'.$height.'" src="'.$link[1].'www.youtube.com/embed/'.$matches[1].'?rel=0&amp;playsinline=1&amp;controls=1&amp;showinfo=0&amp;modestbranding=0" frameborder="0" allowfullscreen></iframe>'; </code></pre> </answer> <answer tick="false" vote="1"> <p>我尝试了Document360的这个解决方案,它有效。</p> <p>解决方案链接:</p> <p><a href="https://docs.document360.com/docs/embed-youtube-shorts" rel="nofollow noreferrer"><strong>如何嵌入 YouTube Shorts?</strong></a></p> <p>从地址栏中复制视频链接,单击共享,然后将 URL 中的“<strong>/shorts/</strong>”替换为“<strong>/embed/</strong>”。这样您就可以在页面或文章中嵌入任何 YouTube Shorts 视频。</p> </answer> </body></html>
你们能帮我吗,我不知道如何将视频显示为动态源视频网址。这是我的假人 接口 DummyMusicDataSource { fun getMusicData(context: Context): List } c...
在我正在进行的一个项目中,我们将媒体团队已发布到数据库中的一堆 YouTube 视频拉入数据库,以便我们可以将它们呈现为相关内容。 我们希望成为...
我很困惑,这个url中使用的youtube api我想测试它是否有效,我的意思是这个url的端点在youtube上没有改变,但我不确定我是哪种类型的api.. .
如何使用 ffmpeg 将相机捕获帧发送到 YouTube 流媒体
导入子流程 导入CV2 # YouTube 流媒体设置 YOUTUBE_URL =“rtmp://a.rtmp.youtube.com/live2/” 键=“...” # OpenCV 相机设置 上限 = cv2.VideoCapture(0) 上限设置...
如何使Python模块yt-dlp在下载播放列表时忽略私人视频
我正在下载一个包含一些隐藏视频的播放列表,所以python给了我下载错误,我想立即下载整个播放列表。有解决办法吗? 我正在尝试看看我是否可以做到...
我正在使用 IFTTT 自动将新的 YouTube 视频发布到 WordPress。每次我上传新视频时,都会使用以下 HTML 代码生成一个新的 WP 帖子: [vc_row row_height_percent =“0”覆盖...
我需要添加一个课程。 像这样 : 到 ... 我需要添加一个班级。 像这样: <iframe width="480" height="270" src="https://www.youtube.com/"> </iframe> 至 <div class="video-class"> <iframe width="480" height="270" src="https://www.youtube.com/"> </iframe> </div> 感谢您的帮助 您可以使用 jQuery 的 .wrap() 函数将一个元素与另一个元素包装在一起。例如: $('iframe').wrap($('<div>', { 'class': 'video-class' })); .video-class { padding: 10px; background-color: red; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <iframe width="480" height="270" src="https://www.youtube.com/"> </iframe> (添加样式以演示包装的元素,不过您也可以在浏览器的开发工具中检查 DOM。)
是否可以通过youtube API查找任何youtube视频的观看时间和观看历史记录?如果是的话怎么办?如果没有,请告诉我任何替代方案。谢谢
如何使用pytube通过python下载年龄限制的视频(音乐)
我已经制作了可以下载mp4视频并将其导出为mp3的代码。您可以选择要下载的播放列表或视频。 我尝试过:在我的代码中,它尝试下载视频,但如果年龄
Youtube 数据 API 在一段时间内的大多数浏览中得到错误的结果
我正在探索 Youtube Data API,我正在尝试获取一段时间内发布的观看次数最多的视频。问题是,我没有得到准确的结果。我输入了我的代码和结果...