首页 文章

获取隐藏视频的元数据[Vimeo]

提问于
浏览
0

环境:在Windows Server 2008上运行的ASP.NET 4.0表单Visual Studio 2010 Ultimate DotNetOpenAuth(刚刚学习)

尝试做一些非常简单的事情,使用Vimeo作为主机创建视频存档,但我们希望它们在Vimeo上,只需嵌入我们的网站 . 我们上传了一些示例视频,并将其设置为隐藏并限制嵌入到我们的域中 . 在测试它时,它们嵌入很好但是当我们发送视频信息请求(http://vimeo.com/api/v2/video/ * .xml)时,服务器响应404找不到 . 如果我们返回并将其设置为任何人都可以查看,我们将获得所需的响应信息 . 我们如何获取视频信息并仍然隐藏视频?

private string GetVideoXML(string id)
{
    try
    {
        // URL
        String url = string.Format("http://vimeo.com/api/v2/video/{0}.xml", id);

        // Make the request
        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
        string token = "<My authorization token from Vimeo API>";           
        request.Headers.Add("Authorization", "Basic " + token);

        // Show me the money?
        WebResponse response = request.GetResponse();  // Throws an exception, 404 not found

        // Read XML
        StreamReader reader = new StreamReader(response.GetResponseStream());
        String responseData = reader.ReadToEnd();

        //Close
        reader.Close();
        response.Close();

        // Show me the money!
        return responseData;            

    }
    catch (Exception ex)
    {
        // You has some 'splaining to do
        litError.Text = ex.ToString();
    }
}

1 回答

  • 0

    您提供的URL(http://vimeo.com/api/v2/video/ * .xml)是Simple API . Simple API无法访问私有数据(如文档中所述) .

    Simple API也已被弃用,以支持新API(https://developer.vimeo.com/api) . 新API支持具有适当身份验证令牌的私有视频 .

    Vimeo目前没有为新API提供ASP库,但值得关注https://developer.vimeo.com/api/libraries以查看是否已更改 .

    即使没有图书馆,也不应该太难以自己追踪它 .

    使用正确的 endpoints 和凭据,您应该会看到包含所有视频的JSON响应,包括私有视频 .

相关问题