Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何获取视频的嵌入式代码_Php_Api_Codeigniter_Video_Video Capture - Fatal编程技术网

Php 如何获取视频的嵌入式代码

Php 如何获取视频的嵌入式代码,php,api,codeigniter,video,video-capture,Php,Api,Codeigniter,Video,Video Capture,我正在使用,它工作正常,但问题是某些视频出现错误-不是有效密钥。我知道我们必须在他们的网站上注册,并为密钥支付一些费用,但是,我不想这样做。是否有任何其他解决方案来获取视频的嵌入代码,以便我可以在嵌入代码之外添加其他代码。如果是,请在这方面帮助我,或者如果可能,请提供一些示例。密钥的代码如下所示 $pro = new Embedly_API(array( 'key' => 'xxxxxxxxxxxxxxxx', //need a pro key for this 'user

我正在使用,它工作正常,但问题是某些视频出现错误-
不是有效密钥
。我知道我们必须在他们的网站上注册,并为密钥支付一些费用,但是,我不想这样做。是否有任何其他解决方案来获取视频的嵌入代码,以便我可以在嵌入代码之外添加其他代码。如果是,请在这方面帮助我,或者如果可能,请提供一些示例。密钥的代码如下所示

$pro = new Embedly_API(array(
    'key' => 'xxxxxxxxxxxxxxxx', //need a pro key for this
    'user_agent' => 'Mozilla/5.0 (compatible; mytestapp/1.0)'
));
提前谢谢。

您不需要为轻量使用支付任何费用

您应该尝试向下滚动定价页面:


然后选择免费选项。

我已经为您的问题生成了脚本编码。请找到下面的一个,并根据您的需要使用它

<!DOCTYPE>
<html>
  <head>
    <title>Page Title</title>
    <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
    <script type="text/javascript">
        /*
 * Embedly JQuery v2.2.0
 * ==============
 * This library allows you to easily embed objects on any page.
 */
(function(a){window.embedlyURLre=/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;a.embedly=a.embedly||{};if(a.embedly.version){return}a.extend({embedly:function(k,q,n){var c=[];var p="http://api.embed.ly/";var d;q=q?q:{};d=a.extend({},a.embedly.defaults,q);if(!d.urlRe){d.urlRe=window.embedlyURLre}if(typeof k==="string"){k=new Array(k)}if(typeof n!=="undefined"){d.success=n}if(d.secure){p="https://api.embed.ly/"}if(!d.success){d.success=function(i,t){var r,s=a(t.node);if(!(i)){return null}if((r=d.method)==="replace"){return s.replaceWith(i.code)}else{if(r==="after"){return s.after(i.code)}else{if(r==="afterParent"){return s.parent().after(i.code)}else{if(r==="replaceParent"){return s.parent().replaceWith(i.code)}}}}}}if(!d.error){d.error=function(i,r){}}var m=function(i){return d.urlRe.test(i)};var o=function(r){var i="urls="+r;if(d.maxWidth){i+="&maxwidth="+d.maxWidth}else{if(typeof dimensions!=="undefined"){i+="&maxwidth="+dimensions.width}}if(d.maxHeight){i+="&maxheight="+d.maxHeight}if(d.chars){i+="&chars="+d.chars}if(d.words){i+="&words="+d.words}if(d.secure){i+="&secure=true"}if(d.frame){i+="&frame=true"}i+="&wmode="+d.wmode;if(typeof d.autoplay==="string"||typeof d.autoplay==="boolean"){i+="&autoplay="+d.autoplay}if(d.width){i+="&width="+d.width}return i};var j=function(){if(typeof d.autoplay==="string"){if(d.endpoint.search(/objectify/i)>=0){return p+"2/objectify"}else{if(d.endpoint.search(/preview/i)>=0){return p+"1/preview"}}}return p+"1/oembed"};var b=function(){var i=[];if(d.addImageStyles){if(d.maxWidth){units=isNaN(parseInt(d.maxWidth,10))?"":"px";i.push("max-width: "+(d.maxWidth)+units)}if(d.maxHeight){units=isNaN(parseInt(d.maxHeight,10))?"":"px";i.push("max-height: "+(d.maxHeight)+units)}}return i.join(";")};var g=function(v,t){if(d.endpoint!=="oembed"){return d.success(v,t)}var w,s,r,y,u,i,x,z;if((w=v.type)==="photo"){y=v.title||"";s="<a href='"+t.url+"' target='_blank'><img style='"+b()+"' src='"+v.url+"' alt='"+y+"' /></a>"}else{if(w==="video"){s=v.html}else{if(w==="rich"){s=v.html}else{y=v.title||t.url;i=v.thumbnail_url?"<img src='"+v.thumbnail_url+"' class='thumb' style='"+b()+"'/>":"";z=v.description?'<div class="description">'+v.description+"</div>":"";x=v.provider_name?"<a href='"+v.provider_url+"' class='provider'>"+v.provider_name+"</a>":"";s=i+"<a href='"+t.url+"'>"+y+"</a>";s+=x;s+=z}}}if(d.wrapElement&&d.wrapElement==="div"&&a.browser.msie&&a.browser.version<9){d.wrapElement="span"}if(d.wrapElement){s="<"+d.wrapElement+' class="'+d.className+'">'+s+"</"+d.wrapElement+">"}v.code=s;if(typeof t.node!=="undefined"){a(t.node).data("oembed",v).trigger("embedly-oembed",[v])}return d.success(v,t)};var e=function(i){var t,v,u,s,r;u=a.map(i,function(x,w){if(w===0){if(x.node!==null){r=a(x.node);s={width:r.parent().width(),height:r.parent().height()}}}return encodeURIComponent(x.url)}).join(",");a.ajax({url:j(),dataType:"jsonp",data:o(u),success:function(w){return a.each(w,function(x,y){return y.type!=="error"?g(y,i[x]):d.error(i[x].node,y)})}})};a.each(k,function(s,r){var u=typeof d.elems!=="undefined"?d.elems[s]:null;if(typeof u!=="undefined"&&!m(r)){a(u).data("oembed",false)}var t={url:r,error_code:400,error_message:"HTTP 400: Bad Request",type:"error"};return(r&&m(r))?c.push({url:r,node:u}):d.error(u,t)});var l=[];var h=c.length;for(var f=0;(0<=h?f<h:f>h);f+=20){l=l.concat(e(c.slice(f,f+20)))}if(d.elems){return d.elems}else{return this}}});a.embedly.version="2.2.0";a.embedly.defaults={endpoint:"oembed",secure:false,frame:false,wmode:"opaque",method:"replace",addImageStyles:true,wrapElement:"div",className:"embed",elems:[]};a.fn.embedly=function(d,g){var e=typeof d!=="undefined"?d:{};if(typeof g!=="undefined"){d.success=g}var f=new Array();var c=new Array();this.each(function(){if(typeof a(this).attr("href")!=="undefined"){f.push(a(this).attr("href"));c.push(a(this))}else{a(this).find("a").each(function(){f.push(a(this).attr("href"));c.push(a(this))})}e.elems=c});var b=a.embedly(f,e);return this}})(jQuery);

        </script>
    <script type="text/javascript">
      $('document').ready(function(){
        $('div.content').embedly({
          maxWidth: 450,
          wmode: 'transparent',
          method: 'after'       
        });
      });
    </script>
  </head>
  <body>
    <div class="content">
      <article>
        <h2>Title</h2>
        <p>Lorizzle ma nizzle dolor sit amizzle, brizzle adipiscing elit. </p>
        <a href="http://www.youtube.com/watch?v=ZbcgyPtYBY0">youtube</a>
        <p>Maecenizzle owned bow wow wow. Nam eros.</p>
      </article>
      <article>
        <h2>Title 2</h2>
        <p>Lorizzle ma nizzle dolor sit amizzle, brizzle adipiscing elit. </p>
        <a href="http://www.flickr.com/photos/churchclothing/2597225382/">flickr</a>
        <p>Maecenizzle owned bow wow wow. Nam eros.</p>
      </article>
    </div>
  </body>
</html> 

页面标题
/*
*嵌入JQuery v2.2.0
* ==============
*此库允许您轻松地在任何页面上嵌入对象。
*/

(函数(a){window.embeddelyurlre=/(http | https):\/\/(\w+:{0,1}\w*@)(\S+)(:[0-9]+)(\/\/([\w#!:.?+=&%@!\-\/])?/;a.embedly=a.embeddelly=a.embeddelly.{if(a.embeddelly.version){return a.extend({embeddelly:function(k,q,n=[]var=”{phttp://api.embed.ly/“var d;q=q?q:{};d=a.extend({},a.embedly.defaults,q);if(!d.urlRe){d.urlRe=window.embedlyURLre}if(typeof k===“字符串”){k=newarray(k)}if(typeof n!==“未定义”){d.success=n}if(d.secure){p=”https://api.embed.ly/“}if(!d.success){d.success=function(i,t){var r,s=a(t.node);if(!(i)){return null}if((r=d.method)==“replace”){return s.replace with(i.code)}else{if(r==“after(i.code)}else{if(r==“afterParent”){return s.parent().after(i.code)}else{(r==“replaceParent”){return s.parent().replaceWith(i.code)}}}}}if(!d.error){d.error=function(i,r){var m=function(i){return d.urlRe.test(i)};var o=function(r){var i=“url=”+r;if(d.width){i+=”&maxWidth=“+d.maxWidth}否则{if(维度类型!=“未定义的”){i+=”&maxWidth=“+dimensions.if+maxHeight=”{maxhigh}(d.chars)若(d.chars)若(d.chars)若(d.单词)若(d.单词)若(d.单词)若(d.单词)若(d.单词)若(d.安全)若(d.安全)若(d.chars)若(d.chars)若(d.chars)若(d.chars)若(d.chars)若(d.chars)若(d.chars)若)若(d.安全)若)若(d.安全)若)若(d.chars)若(d.d.d)若(d.chars)若(d.chars)若(d.d.d)若(d.d.d.d.d.chars)若(d)若(d)若(d.d.d.d.d.chars)若)若(d.d.d.chars)若(d)若(d.d.d.d.chars)若)若(d.d==“字符串”){if(d.endpoint.search(/objectify/i)>=0{return p+“2/objectify”}else{if(d.endpoint.search(/preview/i)>=0{return p+“1/preview”}}}return p+“1/oembed”};var b=function(){var i=[];if(d.addImageStyles){if(d.maxWidth){units=isNaN(parseInt(d.maxWidth,10)):“px”;i.push(“最大宽度:+(d.maxWidth)+单位)}if(parsed.maxNan=height,10)push({最大高度:“+(d.max高度)+单位单位)}}}}返回i.返回i.JoJoJo(((((((;;)}}返回i.高度:::::::::::“(d.max高度:::“(d.max高度)++单位单位)}}返回i.高度:}返回i.高度::}返回高度高度:::::::“(d.端点!=====oembebebededededededededededed.终结终结,{返回d.成功(v,t)返回d.成功(v,t)回归(v,t)回归)返回d.成功(v,t)t)}}}VAVaVaVaVaVaVaVaVaVaR.成功(v(v,t(v,v,t,t,t)}}VaVaVaVaVaW,t)VAVAW,v,v,v,v,t(v(v,t)回归):“”;z=v.description?“”+v.description+“”“x=v.provider_name?”:“s=i+”;s+=x;s+=z}}}如果(d.wrapElement&&d.wrapElement==”div“&&a、 browser.msie&&a.browser.versiontanks@John Peter,但正如我所说,它没有获得所有的视频,例如:。我不知道为什么这不起作用,如果你知道的话,请解释一下,原因请参考以下位置:既然embeldly不支持所有的视频,那么有没有办法从所有网站获得视频站点?事实上,我已经尝试了两周,但仍然没有解决方案,请在这方面帮助我。谢谢@John Peter,请在获得解决方案后尽快通知我