作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
目前,我正在开发一个Web应用程序,该应用程序允许用户将任何Youtube视频发布到他们管理的个人资料或页面上。这是我用来将YouTube视频发布到我的个人资料的代码
$videoUpload = $fb->post('/me/videos', ['description' => 'example description', 'file_url' => 'https://r2---sn-npoeene7.googlevideo.com/videoplayback?pl=24&lmt=1513082002389285&id=o-AIPnl4v8svvYBTFPYwJOsRanE_5O8YSK0F3bMkTqN6QR&itag=22&signature=8051FCC4C243296224CD1D7ADB4E5C0A90125C57.66FF9FF2063C3A8F00F143FB51BB3E98F7AEBB7B&requiressl=yes&ip=203.189.156.104&sparams=dur,ei,expire,id,initcwndbps,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pl,ratebypass,requiressl,source&key=cms1&mime=video%2Fmp4&dur=301.952&fvip=2&ipbits=0&c=WEB&expire=1519648901&ratebypass=yes&ei=JayTWtSaDcWqoQORionoCg&source=youtube&redirect_counter=1&cm2rm=sn-jvbxuxavoapox-2oil7e&fexp=23712580&req_id=21384f45d53ba3ee&cms_redirect=yes&mm=29&mn=sn-npoeene7&ms=rdu&mt=1519627218&mv=m'], $access_token);
$videoUpload = $videoUpload->getGraphNode()->asArray();
<?php
$id = 'RllJtOw0USI';
if (isset($_GET["id"]))
$id = $_GET["id"];
parse_str(file_get_contents('http://www.youtube.com/get_video_info?video_id='.$id), $video_data);
$streams = $video_data['url_encoded_fmt_stream_map'];
$streams = explode(',',$streams);
$counter = 1;
foreach ($streams as $streamdata) {
printf("Stream %d:<br/>----------------<br/><br/>", $counter);
parse_str($streamdata,$streamdata);
foreach ($streamdata as $key => $value) {
if ($key == "url") {
$value = urldecode($value);
printf("<strong>%s:</strong> <a href='%s'>video link</a><br/>", $key, $value);
} else {
printf("<strong>%s:</strong> %s<br/>", $key, $value);
}
}
$counter = $counter+1;
printf("<br/><br/>");
}
?>
status=fail&errorcode=150&errordetail=0&reason=This+video+contains+content+from+Vevo.+It+is+restricted+from+playback+on+certain+sites+or+applications.%0A%3Ca+href%3D%27http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdMK_npDG12Q%26feature%3Dplayer_embedded%27+target%3D%27_blank%27%3EWatch+on+YouTube%3C%2Fa%3E
最佳答案
如果您在json中查看原因,您会看到
This video contains content from Vevo. It is restricted from playback on certain sites or applications
关于php - 如何从PHP中的任何Youtube视频生成下载链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49005512/
我是一名优秀的程序员,十分优秀!