Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
以编程方式(C#)检索具有给定url或用户ID的google博客数据_C#_Google Api_Blogger - Fatal编程技术网

以编程方式(C#)检索具有给定url或用户ID的google博客数据

以编程方式(C#)检索具有给定url或用户ID的google博客数据,c#,google-api,blogger,C#,Google Api,Blogger,我正在创建一个c#控制台应用程序,它将使用用户ID和密码从特定用户的所有博客中检索数据 所以我找到了下面的代码--> 使用Google.GData.Blogger; 使用Google.GData.Client; 命名空间控制台应用程序5 { 班级计划 { 静态void Main(字符串[]参数) { 服务=新服务(“博主”、“博主示例”); //使用用户名/密码身份验证的客户端登录 字符串用户名; 字符串密码; 如果(参数长度!=2) { WriteLine(“用法:BloggerDevSamp

我正在创建一个c#控制台应用程序,它将使用用户ID和密码从特定用户的所有博客中检索数据

所以我找到了下面的代码-->

使用Google.GData.Blogger;
使用Google.GData.Client;
命名空间控制台应用程序5
{
班级计划
{
静态void Main(字符串[]参数)
{
服务=新服务(“博主”、“博主示例”);
//使用用户名/密码身份验证的客户端登录
字符串用户名;
字符串密码;
如果(参数长度!=2)
{
WriteLine(“用法:BloggerDevSample.exe”);
返回;
}
其他的
{
用户名=args[0];
密码=args[1];
}
service.Credentials=新的GDataCredentials(用户名、密码);
ListUserBlogs(服务);
Console.WriteLine(“按enter键退出”);
Console.ReadLine();
}
静态void ListUserBlogs(服务)
{
Console.WriteLine(“\n正在检索博客列表”);
FeedQuery=新建FeedQuery();
//检索博客列表
query.Uri=新Uri(“http://www.blogger.com/feeds/default/blogs");
AtomFeed feed=null;
feed=service.Query(查询);
foreach(feed.Entries中的原子条目)
{
Console.WriteLine(“博客标题:+entry.title.Text”);
}
}
}
}
它当前正在使用用户名和密码获取数据,这应该是已知的,
但是我希望使用特定博客的URL获取博客数据,因此,任何博客数据都可以通过博客URL访问,而无需私人凭据(用户名和密码)。
我认为这可以通过Goggle提供的一些API来实现,但是如何实现呢

阅读博客RSS提要怎么样?

::不明白。。。你能解释一下或者给我一个链接来获取更多的abt RSS提要吗?大多数博客都使用RSS来公开网站的内容。它们基本上遵循一种简单的XML格式。基本上,每个博客都会发布一个RSS url,公开它的帖子。任何人都可以阅读它,因为它是公开的。唯一的问题是,博客可能会选择只通过它发布最新的帖子。如果你想阅读所有的文章,那么这是行不通的。这里是RSS简介的链接。@Kiquenet@拉基塔;但我得到了未经授权的例外。。。
using Google.GData.Blogger;
using Google.GData.Client;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            Service service = new Service("blogger", "blogger-example");

            // ClientLogin using username/password authentication
            string username;
            string password;
            if (args.Length != 2)
            {
                Console.WriteLine("Usage: BloggerDevSample.exe <username> <password>");
                return;
            }
            else
            {
                username = args[0];
                password = args[1];
            }

            service.Credentials = new GDataCredentials(username, password);

            ListUserBlogs(service);

            Console.WriteLine("Press enter to quit");
            Console.ReadLine();
        }

        static void ListUserBlogs(Service service)
        {
            Console.WriteLine("\nRetrieving a list of blogs");
            FeedQuery query = new FeedQuery();
            // Retrieving a list of blogs   
            query.Uri = new Uri("http://www.blogger.com/feeds/default/blogs");
            AtomFeed feed = null;
            feed = service.Query(query);
            foreach (AtomEntry entry in feed.Entries)
            {
                Console.WriteLine("  Blog title: " + entry.Title.Text);
            }
        }
    }
}