对象引用未设置为对象的实例,即youtube API

时间:2012-05-12 01:41:12

标签: api pointers null youtube

class Program
{
    static void Main(string[] args)
    {
        string Appname;
        string developerKey;
        string username;
        string password;

        Appname = "a";
        developerKey = "b";
        username = "c";
        password = "d";

        YouTubeRequestSettings settings = new
           YouTubeRequestSettings(Appname, developerKey, username, password);
        YouTubeRequest request = new YouTubeRequest(settings);

        Uri videoEntryUrl = new
            Uri("http://www.youtube.com/watch?v=dOShGP0FM1U");
        Video video = request.Retrieve<Video>(videoEntryUrl);

        Comment MyComment = new Comment();
        MyComment.Content = "random tango";
        if (video != null)
        {
            request.AddComment(video, MyComment);
        }
        else
        {
            Console.Write("Video was null for some reason!");
            Console.ReadKey();
        }
    }
}

出于某种原因,视频一直返回null并且我无法弄清楚,我已经尝试了所有我真正需要帮助的项目。

0 个答案:

没有答案