I am trying to parse the XML for Vimeo clips, so that I can populate the thumbnail, Title and description on an ASP page.

I can set the tartget to the Vimeo XML file, but cannot for the life of me get the actual content, let alsone isolate and use the various elements.

The XML generated for any clip is the same, here is an example:

<?xml version="1.0" encoding="utf-8"?>
<videos>
<video>
<id>32748327</id>
<title>Crafty - short film</title>
<description>
A crafty housewife gets more than she bargained for when an activist shows up at her door. Starring Jenny Hagel and Amy Phillips.<br /> <br /> Screenings include Palm Springs International Shortfest, Nashville Film Festival, and Frameline: The San Francisco LGBT Film Festival<br /> Broadcast on The Logo Channel (MTV Networks)<br /> DVD release through Strand Releasing
</description>
<url>http://vimeo.com/32748327</url>
<upload_date>2011-11-27 15:14:18</upload_date>
<mobile_url>http://vimeo.com/m/32748327</mobile_url>
<thumbnail_small>http://b.vimeocdn.com/ts/221/767/221767629_100.jpg</thumbnail_small>
<thumbnail_medium>http://b.vimeocdn.com/ts/221/767/221767629_200.jpg</thumbnail_medium>
<thumbnail_large>http://b.vimeocdn.com/ts/221/767/221767629_640.jpg</thumbnail_large>
<user_id>3116245</user_id>
<user_name>Erik Gernand</user_name>
<user_url>http://vimeo.com/erikgernand</user_url>
<user_portrait_small>http://b.vimeocdn.com/ps/760/760227_30.jpg</user_portrait_small>
<user_portrait_medium>http://b.vimeocdn.com/ps/760/760227_75.jpg</user_portrait_medium>
<user_portrait_large>http://b.vimeocdn.com/ps/760/760227_100.jpg</user_portrait_large>
<user_portrait_huge>http://b.vimeocdn.com/ps/760/760227_300.jpg</user_portrait_huge>
<stats_number_of_likes>4</stats_number_of_likes>
<stats_number_of_plays>4948</stats_number_of_plays>
<stats_number_of_comments>0</stats_number_of_comments>
<duration>499</duration>
<width>640</width>
<height>360</height>
<tags>comedy, film, lesbian, activist</tags>
<embed_privacy>anywhere</embed_privacy>
</video>
</videos>

The code I use on a page, should be able to get all the bits and show a thumbnail of the clip, which will then become a link to a modal page which will then run the actual video.

The code I am trying to work with is as follows, which is on a test page to see if I can use both YouYube and Vimeo clips and the URL is checked to see if it contais "vimeo":

  <% 

 ClipURL=Request("Clip") %>


  <% If (InStr(ClipURL,"vimeo"))<>0 Then 
response.Write("Vimeo Clip")

ClipID=Replace(ClipURL, "http://vimeo.com/", "")
' run the code to show the clip %>
  <br />
  <% XML_file ="http://vimeo.com/api/v2/video/"& ClipID&".xml" %><br />
  <%=XML_file  %> <a href="<%= XML_file %>" target="_blank">Link to the XML file</a><br />

 <br />



  <%' code snippet from existing example on DaniWeb - has not results
' Create new XML reader object
Dim xmlDoc
Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
' Load the specified XML file (returns XML output)
xmlDoc.load("http://vimeo.com/api/v2/video/"& ClipID&".xml")
' Parse XML
if xmlDoc.parseError.errorcode <> 0 then
  ' oops error in xml
  Response.Write("XML Error...<br>")
else
  ' get xml data
  Response.Write(xmlDoc.documentElement.childNodes(0).attributes.getNamedItem("code").nodeValue)
end if
%>   

 <% 'Thumbnail from the XML file to display here %>

<br />

</p>
<iframe src="http://player.vimeo.com/video/<%= ClipID %>" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> 


So far I have had no luck at all with this and any assistance would be greatly appreciated.

Recommended Answers

All 2 Replies

Thank you ListMitch, this was most helpful. I have managed to get all the elements I need and it all works fine now.

Much appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.