Search code examples
pythonapivimeo

Using vimeo api (Python)


I have a mission to get for example the numbers of views of some video on vimeo using vimeo api.

I opened a user (developer), i send request for some video and i recived an html object.

NEW EDIT : This is my code :

import vimeo

client = vimeo.VimeoClient(
Api details…)
response = client.get('https://api.vimeo.com/videos/!video_id')
response
response.headers['content-type']

   <Response [200]>
'application/vnd.vimeo.video+json'

But i recived an HTML object, my question is if i can get from the HTML object the number of reviews also, or there is another way to do this ? UPDATE: in the content type we can see that i got the json object as i needed


Solution

  • LAST EDIT: although the play count is documented in the API at https://developer.vimeo.com/api/reference/response/video (under stats.plays) after testing it myself it looks like it always returns "null" - they may have disabled play counts.

    EDIT: sorry I misunderstood your need - I thought you were looking for "reviews" so I assumed comments. If you are looking for the number of VIEWS, that should be in the meta data retrieved from "https://api.vimeo.com/videos/!video_id"

    so change your line to:

    response = client.get('https://api.vimeo.com/videos/700495031')