Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

LaL

Script

Recommended Posts

Pessoal eu to com 1 probleminha aqui é que eu peguei 1 script na net que é assim vo tenta explica:

 

O script redireciona videos do youtube para o site +- isso ai por exemplo:

 

se eu for posta algo e por o link do video ja aparece o video no site so de por o link so tenho q por a chave que está no script q no caso é "endofvid" sem aspas o que eu queria era fazer a mesma coisa só que com outros tipo de video como o uol mais entre varios outros se alguem pude me ajudar =] .

 

O site é magazine ai tipo e so por o link do video e a chave q ja aparece 1 imagenzinha pra clika na postagem e ja vem o video quero que fique assim so que com outros tipo de videos se alguem souber msm qualquer dica eu to aceitando :(

 

<script type='text/javascript'>
//<![CDATA[
function showlabelpostswiththumbs(json){document.write('<ul class="label_posts_with_thumbs">');for(var i=0;i<numposts;i++){var entry=json.feed.entry[i];var posttitle=entry.title.$t;var posturl;if(i==json.feed.entry.length)break;for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='replies'&&entry.link[k].type=='text/html'){var commenttext=entry.link[k].title;var commenturl=entry.link[k].href}if(entry.link[k].rel=='alternate'){posturl=entry.link[k].href;break}}if("content"in entry){var postcontent=entry.content.$t}var vidid=postcontent.substring(postcontent.indexOf("http://www.youtube.com/watch?v=")+31,postcontent.indexOf("endofvid"));try{thumburl='http://i2.ytimg.com/vi/'+vidid+'/default.jpg'}catch(error){thumburl='http://4.bp.blogspot.com/-YoCA0ocXbp8/T85Ae3Tn7II/AAAAAAAAGn8/pmsXs1_sB5c/s1600/no_video_preview.gif'}var postdate=entry.published.$t;var cdyear=postdate.substring(0,4);var cdmonth=postdate.substring(5,7);var cdday=postdate.substring(8,10);var monthnames=new Array();monthnames[1]="Jan";monthnames[2]="Feb";monthnames[3]="Mar";monthnames[4]="Apr";monthnames[5]="May";monthnames[6]="Jun";monthnames[7]="Jul";monthnames[8]="Aug";monthnames[9]="Sep";monthnames[10]="Oct";monthnames[11]="Nov";monthnames[12]="Dec";document.write('<li class="clearfix">');if(showpostthumbnails==true)document.write('<a href="'+posturl+'"><div class="thumb_play_button"></div><img class="label_thumb" src="'+thumburl+'"/></a>');document.write('<div class="label_video_title"><a href="'+posturl+'" target ="_top">'+posttitle+'</a></div><br>');var textinside=postcontent.substring(postcontent.indexOf("[starttext]")+11,postcontent.indexOf("[endtext]"));var re=/<\S[^>]*>/g;postcontent=textinside.replace(re,"");if(showpostsummary==true){if(postcontent.length<numchars){document.write('<div class="label_video_summary">');document.write(postcontent);document.write('</div>')}else{document.write('<div class="label_video_summary">');postcontent=postcontent.substring(0,numchars);var quoteEnd=postcontent.lastIndexOf(" ");postcontent=postcontent.substring(0,quoteEnd);document.write(postcontent+'...');document.write('</div>')}}var towrite='';var flag=0;document.write('<br><div class="label_video_datecomment">');if(showpostdate==true){towrite=towrite+monthnames[parseInt(cdmonth,10)]+' '+cdday+' , '+cdyear;flag=1}if(showcommentnum==true){if(flag==1){towrite=towrite+' | '}if(commenttext=='1 Comments')commenttext='1 Comment';if(commenttext=='0 Comments')commenttext='No Comments';commenttext='<a href="'+commenturl+'" target ="_top">'+commenttext+'</a>';towrite=towrite+commenttext;flag=1}document.write(towrite);document.write('</div></li>')}document.write('</ul>')}
//]]>
</script>

<script type='text/javascript'>
//<![CDATA[
var thumbnail_mode = 'float' ; summary_noimg = 0; summary_img = 0; img_thumb_height = 130; img_thumb_width = 180;

function createVideoThumb(pID){var div=document.getElementById(pID);var summ=summary_noimg;if(div.innerHTML.indexOf("http://www.youtube.com/watch?v=")!=-1){var vidid=div.innerHTML.substring(div.innerHTML.indexOf("http://www.youtube.com/watch?v=")+31,div.innerHTML.indexOf("endofvid"))}else{var vidid=""};var postlink=div.innerHTML.substring(div.innerHTML.indexOf("[postlink]")+10,div.innerHTML.indexOf("[/postlink]"));if(vidid==""){var imgvid='<a href="'+postlink+'"><img  class="thumbnail" src="http://4.bp.blogspot.com/-YoCA0ocXbp8/T85Ae3Tn7II/AAAAAAAAGn8/pmsXs1_sB5c/s1600/no_video_preview.gif" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></a>'}else{var imgvid='<a href="'+postlink+'"><span class="play-button"></span><img  class=thumbnail src="http://i2.ytimg.com/vi/'+vidid+'/default.jpg" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></a>'};var summary=imgvid;div.innerHTML=summary}function createVideoThumb2(pID){var div=document.getElementById(pID);var imgtag="";var summ=summary_noimg;if(div.innerHTML.indexOf("http://www.youtube.com/watch?v=")!=-1){var vidid=div.innerHTML.substring(div.innerHTML.indexOf("http://www.youtube.com/watch?v=")+31,div.innerHTML.indexOf("endofvid"))}else{var vidid=""};var textinside=div.innerHTML.substring(div.innerHTML.indexOf("[starttext]")+11,div.innerHTML.indexOf("[endtext]"));var postlink=div.innerHTML.substring(div.innerHTML.indexOf("[postlink]")+10,div.innerHTML.indexOf("[/postlink]"));var embedvid="";if(vidid!=""){embedvid='<object width="600" height="450"><param name="movie" value="http://www.youtube.com/v/'+vidid+'&hl=en_US&fs=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+vidid+'&hl=en_US&fs=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="600" height="450"></embed></object>'}var summary=embedvid+'<div class="content">'+textinside+'</div>';div.innerHTML=summary}
//]]></script>

Compartilhar este post


Link para o post
Compartilhar em outros sites

meu não vo fica decifrando esse cód mas assim..

crie uma função ajax que leia o endereço e faça uma busca no mesmo buscando a tag/class/id "embeded/embeded-code"

 

cada site possui um "embeded" diferente se não me engano.. então você terá q verificar seu site e utilizar a tag referente a ele. A partir daí só fazer sua implementação

 

Creio que com jQuery você não conseguirá fazer isso utilizando ajax pois ele não permite fazer ajax entre diferentes URL's pelo menos eu não sei como fazer.. vlw bons estudos

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.