Skip to content

Instantly share code, notes, and snippets.

@zelinskiy
Created April 4, 2017 20:36
Show Gist options
  • Select an option

  • Save zelinskiy/7665f46ab81457b6f433b87006b06cda to your computer and use it in GitHub Desktop.

Select an option

Save zelinskiy/7665f46ab81457b6f433b87006b06cda to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VkNet;
using VkNet.Enums.Filters;
using VkNet.Model.RequestParams;
namespace VkStats
{
class Program
{
static void Main(string[] args)
{
// There must be file secrets.txt with
// LOGIN
// PASS
// APPID
var storedSecrets = File.ReadLines("..\\..\\secrets.txt").ToArray();
var login = storedSecrets[0];
var pass = storedSecrets[1];
var applicationId = ulong.Parse(storedSecrets[2]);
const int groupId = 44898240;
const string groupName = "kanonrk";
var vk = new VkApi();
vk.Authorize(new ApiAuthParams
{
ApplicationId = applicationId,
Login = login,
Password = pass,
Settings = Settings.All
});
var members = vk.Groups.GetMembers(new GroupsGetMembersParams
{
GroupId = groupName,
Count = 50,
Fields = UsersFields.All
});
Console.WriteLine("Loaded {0} ids", members.Count);
foreach(var m in members.Take(5))
{
Console.WriteLine("========================");
Console.WriteLine("User {0} {1} top 20:", m.FirstName, m.LastName);
Console.WriteLine("========================");
var groups = vk.Groups.Get(new GroupsGetParams
{
UserId = m.Id,
Count = 20,
Extended = true,
Filter = GroupsFilters.Publics,
Fields = GroupsFields.All
});
foreach (var g in groups)
{
Console.WriteLine(g.Name);
}
}
Console.WriteLine("END OF PROGRAM");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment