-
Notifications
You must be signed in to change notification settings - Fork 16
/
Program.cs
47 lines (38 loc) · 1.39 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using Microsoft.Extensions.DependencyInjection;
using VkNet;
using VkNet.Abstractions;
using VkNet.AudioBypassService.Extensions;
using VkNet.Model;
namespace ConsoleApp
{
internal class Program
{
private static IVkApi _api;
// ReSharper disable once UnusedParameter.Local
private static void Main(string[] args)
{
var serviceCollection = new ServiceCollection();
serviceCollection.AddAudioBypass();
_api = new VkApi(serviceCollection);
Console.WriteLine(" > Номер телефона/E-mail:");
var login = Console.ReadLine();
Console.WriteLine(" > Пароль:");
var password = Console.ReadLine();
_api.Authorize(new ApiAuthParams
{
Login = login,
Password = password,
TwoFactorAuthorization = () =>
{
Console.WriteLine(" > Код двухфакторной аутентификации:");
return Console.ReadLine();
}
});
Console.WriteLine($" > Access Token: {_api.Token}");
var audios = _api.Audio.Get(new AudioGetParams {Count = 10});
foreach (var audio in audios) Console.WriteLine($" > {audio.Artist} - {audio.Title}");
Console.ReadLine();
}
}
}