如何通过.net youtube API直接上传获取上传状态

时间:2012-09-04 16:54:40

标签: c# asp.net youtube youtube-api

我一直尝试使用youtubi API直接上传方法,已成功上传视频,但问题是某些视频在上传后遭到拒绝(拒绝(使用条款违规))。

我需要找到一种在webResponse中跟踪它们的方法,如果我读取了steram(readTOEnd())XML

<app:control>
    <app:draft>yes</app:draft>
    <yt:state name='processing'/>
</app:control>

州名一直显示'处理'。 请指出我对你有任何想法/经验的正确方向。

1 个答案:

答案 0 :(得分:0)

您可以尝试使用此代码

    WebResponse myWebResponse = myWebRequest.GetResponse(); 
    // Obtain a 'Stream' object associated with the response object.
    Stream ReceiveStream = myWebResponse.GetResponseStream();

    Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

     // Pipe the stream to a higher level stream reader with the required encoding format. 
     StreamReader readStream = new StreamReader( ReceiveStream, encode );
     Console.WriteLine("\nResponse stream received");
     Byte[] read = new Byte[256];

     int count = readStream.Read( read, 0, 256 );
     Console.WriteLine("HTML...\r\n");

     if (count > 0) 
     {
           Console.Write("Success Reading");
     }