Ted k’ É assim que tem que ser! Programando em ASP, ASP.NET, PHP, CSS, dentre outras…

26
Feb/09
2



Listar favoritos do YouTube

A Classe:

<%
class YouTube
    private objXML
    private objLista
    private usuario
    private url
    private id, i
    private nome_objeto

    private sub objetosXML()
        set objXML = server.createObject("MSXML2.DOMDocument.3.0")
            objXML.async = false
            objXML.setProperty "ServerHTTPRequest", true
            objXML.validateOnParse = false
            objXML.load(url)
        set objLista = objXML.getElementsByTagName("*")
    end sub

    public sub carregarURL()
        usuario = "nome_do_seu_usuario"
        url = "http://gdata.youtube.com/feeds/api/users/"&usuario&"/favorites"
        call objetosXML()

        for i = 16 to (objLista.length - 1)
            select case (objLista.item(i).nodeName)
                case "id"
                    nome_objeto = objLista.item(i).text
                    id = right(nome_objeto, len(nome_objeto) - instrRev(nome_objeto,"/"))

                    tabela = tabela & "<table width=""494"" border=""0"" cellspacing=""0"" cellpadding=""0"">"
                    tabela = tabela & "<tr><td colspan=""2"">"
                    tabela = tabela & "<object width=225 height=144><param name=movie value=http://www.youtube.com/v/"&id&"></param>"
                    tabela = tabela & "<param name=allowFullScreen value=true></param>"
                    tabela = tabela & "<param name=allowscriptaccess value=always></param>"
                    tabela = tabela & "<embed src=http://www.youtube.com/v/"&id&" type=application/x-shockwave-flash allowscriptaccess=always allowfullscreen=true width=225 height=144></embed>"
                    tabela = tabela & "</object>"
                    tabela = tabela & "</td></tr>"

                case "title"
                    tabela = tabela & "<tr><td width=""92"" valign=""top"" style=""font: 11px Arial;""><strong>TÍTULO:</strong></td>"
                    tabela = tabela & "<td width=""402"" valign=""top"" style=""font: 11px Arial;"">"&objLista.item(i).text&"</td></tr>"

                case "content"
                    tabela = tabela & "<tr><td valign=""top"" style=""text-align: justify; font: 11px Arial;""><strong>DESCRIÇÃO:</strong></td>"
                    tabela = tabela & "<td valign=""top"" style=""font: 11px Arial;"">"&objLista.item(i).text&"</td></tr>"
                    tabela = tabela & "</table><br><br>"
            end select
        next

        response.write(tabela)
    end sub
end class
%>

O HTML

<%@ Language="VBScript" %>
<!--#include file="Default.class.asp"-->
<%
dim yt
set yt = new YouTube
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<%=yt.carregarURL()%>
</body>
</html>

O Resultado:
null

Comentários (2) Trackbacks (0)
  1. Olá,

    Estou começando a programar em ASP agora e to com um pouco de dificuldade e me jogaram uma “bucha” na minha mão me pediram para fazer uma galeria de videos do youtube no site da empresa onde trabalho eu achei um exemplo mas estou com uma imensa dificuldade de fazer a geleria igual ao exemplo que me passaram alguém poderia me dar uma luz please!

    Precisaria fazer algo parecido com o site abaixo

    Exemplo:http://www.yvoschaap.com/youtube/

    Desde já muito obrigado!

  2. melhor postar no fórum amigo, vai ter dificuldades, principalmente pq está começando com ASP.

    posta sua dúvida aqui
    http://forum.imasters.uol.com.br/index.php?showforum=2



Deixe um comentário.


Não há trackbacks ainda.


Portfólio Ted k'

Atualize seu Navegador