Hello :) I am working on a small video site that allows a user to add
a video to the site by submitting a Vimeo.com or Youtube.com URL. I'm
trying to display thumbnails without hosting them. For Vimeo videos I
need to parse an XML file to find the thumbnail location.
On my homepage I would like to display the 5 newest videos. As of now
I'm displaying every video in the database on the homepage. Each video
will have a different thumbnail and XML file to parse. As of right now
my "main_page" in my views.py file looks like this:
def home_page(request):
template = get_template('home_page.html')
video = Video.objects.all()
feed = urllib.urlopen("http://vimeo.com/api/v2/video/7875440.xml")
tree = ET.parse(feed)
root = tree.getroot()
vimeo_thumbnail = root.findtext("video/thumbnail_medium")
variables = Context({
'video': video,
'vimeo_thumbnail': vimeo_thumbnail
})
output = template.render(variables)
return HttpResponse(output)
How can I parse a different XML file for every video? Thank you much.
Again, I am new and could be going about this completely wrong and
gladly accept any feedback you have.
Thank you,
Matt
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.