从curl或get_video_info抓取youtube视频URL [英] grabbing youtube video URL from curl or get_video_info

查看:320
本文介绍了从curl或get_video_info抓取youtube视频URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在研究一个php项目,其中一部分是抓取youtube视频url并将其插入到html5视频标签中.我正在使用curl调用 http://youtube.com/get_video_info?video_id=XXX 并获取正确的视频文件我的本地计算机上的网址.

So, I am working on a php project and one part of it is grabbing a youtube video url and inserting it into an html5 video tag. I was using a curl call to http://youtube.com/get_video_info?video_id=XXX and getting the right video file urls on my local machine.

但是,当我将代码上传到Web服务器并尝试运行它时,所有视频URL均无效.网址看起来不错,但某些参数(例如IP)有所不同.我不明白为什么它可以从运行xampp或mamp的本地计算机上运行,​​但不能在我的Web服务器上运行.我什至尝试只是在youtube视频页面上卷曲,然后注意到在本地,它将输出页面并播放视频,但是在我的网络服务器上,所有视频通话都收到404s.

But, when I uploaded my code to my web server and tried to run it, none of the video URLs have worked. The urls seemed fine but some parameters, like IP, where different. I can't understand why it works from my local machine running xampp or mamp but not on my web server. I even tried just doing a curl on the youtube video page and noticed that locally, it would output the page and play the video but on my webserver, all the video calls got 404s.

关于此的任何信息吗?无论如何,我可以抓取youtube视频的网址,以便可以在html5视频标签中播放youtube视频?这就是为什么keepvid和类似的网站使用该死的Java applet吗?

Any info about this? Anyway I can grab a youtube video url so that I can play youtube videos in a html5 video tag? Is this why keepvid and sites like that use the damn java applet?

推荐答案

您应该看一下 youtube-dl 项目我很确定您可以采取一些思路,以了解实现目标的正确方法.

You should take a look to youtube-dl project I'm pretty sure you can takes some idea to understand the proper way to achieve your goal.

这篇关于从curl或get_video_info抓取youtube视频URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆