Results 1 to 4 of 4

Thread: Xml Package to get a public Youtube feed

  1. #1
    Join Date
    Apr 2006
    Location
    Phoenix AZ
    Posts
    81

    Default Xml Package to get a public Youtube feed

    here's a quick XML package to get a public Youtube feed (be aware of namespaces & default namespaces):

    Code:
    <package displayname="YouTubeFeed" version="2.1" debug="false" includeentityhelper="false">
      <webquery name="youtube" RetType="xml">
        <url>http://gdata.youtube.com/feeds/api/users/{username}/uploads?orderby=updated&amp;max-results={maxResults}</url>
        <querystringreplace replaceTag="{username}" replacetype="request" paramtype="runtime"
          replaceparamname="username" defvalue="molinafinejewelers" validationpattern=""/>
        <querystringreplace replaceTag="{maxResults}" replacetype="request" paramtype="runtime"
          replaceparamname="maxResults" defvalue="3" validationpattern="^\d{1,10}$"/>
      </webquery>
      <PackageTransform>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                        xmlns:aspdnsf="urn:aspdnsf"
                        xmlns:atom="http://www.w3.org/2005/Atom"
                        xmlns:media="http://search.yahoo.com/mrss/"
                        xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
                        xmlns:gd="http://schemas.google.com/g/2005"
                        xmlns:yt="http://gdata.youtube.com/schemas/2007"
                        exclude-result-prefixes="aspdnsf atom media openSearch gd yt">
          <xsl:output method="html" omit-xml-declaration="yes" />
    
          <xsl:template match="/">
            <xsl:apply-templates select="/root/youtube/atom:feed/atom:entry" />
          </xsl:template>
    
          <xsl:template match="atom:entry">
    
            <div class="entry">
              <a target="_blank" class="imagelink">
                <xsl:attribute name="href" >
                  <xsl:value-of select="media:group/media:player/@url" />
                </xsl:attribute>
                <img alt="video" height="90" width="120" >
                  <xsl:attribute name="src" >
                    <xsl:value-of select="media:group/media:thumbnail[2]/@url" />
                  </xsl:attribute>
                </img>
              </a>
              <p>
                <a target="_blank" class="titlelink">
                  <xsl:attribute name="href" >
                    <xsl:value-of select="media:group/media:player/@url" />
                  </xsl:attribute>
                  <xsl:value-of select="aspdnsf:GetMLValue(atom:title)" />
                </a>
                <br />by&#160;<a target="_blank" class="authorlink">
                  <xsl:attribute name="href" >
                    <xsl:value-of select="concat('http://www.youtube.com/user/', atom:author/atom:name)" />
                  </xsl:attribute>
                  <xsl:value-of select="aspdnsf:GetMLValue(atom:author/atom:name)" />
                </a>
                <br />views&#160;<xsl:value-of select="yt:statistics/@viewCount" />
              </p>
            </div>
    
          </xsl:template>
        </xsl:stylesheet>
    
      </PackageTransform>
    </package>

  2. #2
    Join Date
    Feb 2008
    Posts
    35

    Default links to youtube channel

    How can we alter this xml package so the thumbnails actually link to the videos on the channel / profile page?

  3. #3
    Join Date
    Apr 2006
    Location
    Phoenix AZ
    Posts
    81

    Default

    as far as I know, you can't link directly to a video on a channel/profile page - the video thumbnails in this package actually link to the video in a standard YouTube player - the profile name links to the channel/profile page.

    for a development example see - http://molina-aspdotnetstorefront.st...e-social-scene

    bottom left section

  4. #4
    Join Date
    Apr 2006
    Location
    Phoenix AZ
    Posts
    81

    Default

    actually if you want to link to the channel/profile page - you'll need to simply compose links similar to http://www.youtube.com/user/molinafi.../0/nHpiZpEQFTY

    You'll have to dig through the API docs on how to generate these links

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •