Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
107 lines (99 loc) · 3.38 KB
/
Copy pathProgram.cs
File metadata and controls
107 lines (99 loc) · 3.38 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
using Solnet.Rpc;
namespace Scraper
{
class Program
{
/// <summary>
/// The rpc client instance.
/// </summary>
private static IRpcClient _rpcClient;
/// <summary>
/// The names of the collections to get and the separator of their number.
/// </summary>
private static Dictionary<string, string> _collections = new()
{
/*{"Bold Badger", "#"}
{ "SolPunk", "#" },
{ "Degen Ape", "#"},
{ "Solanimal", "#" },
{ "SolMee", "#"},
{ "THUG", "#" },
{ "Top Hat Chicks", "#" },
{ "Solstones", ""},
{ "Nogoalfaces", ""},
{ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "#"},
{ "BOOGLE", "#" },
{ "SSBxSolPunk", "Punk_#" },
{ "Abstraction", "No."},
{ "Frakt", "-"},
{ "SolanaDoge", "#" },
{ "Sollamas", "#" },
{ "SMB", "#"}*/
};
private static void Main(string[] args)
{
ILogger _logger = null;
#if DEBUG
_logger = GetDebugLogger();
#elif RELEASE
_logger = GetInformationLogger();
#endif
_rpcClient = ClientFactory.GetClient(Cluster.MainNet);
_logger.LogInformation($"Launching scrapers.");
foreach (var collection in _collections)
{
if (collection.Key == "SMB")
{
var symbolScraper = new SymbolScraper(
_rpcClient,
_logger,
collection.Key,
collection.Value);
Task.Run(() => symbolScraper.Run());
continue;
}
var nameScraper = new NameScraper(
_rpcClient,
_logger,
collection.Key,
collection.Value);
Task.Run(() => nameScraper.Run());
}
_logger.LogInformation("Finished scraping metadata.");
Console.ReadKey();
}
private static ILogger GetInformationLogger()
{
return LoggerFactory.Create(x =>
{
x.AddSimpleConsole(o =>
{
o.UseUtcTimestamp = true;
o.IncludeScopes = true;
o.ColorBehavior = LoggerColorBehavior.Enabled;
o.TimestampFormat = "HH:mm:ss ";
})
.SetMinimumLevel(LogLevel.Information);
}).CreateLogger<NameScraper>();
}
private static ILogger GetDebugLogger()
{
return LoggerFactory.Create(x =>
{
x.AddSimpleConsole(o =>
{
o.UseUtcTimestamp = true;
o.IncludeScopes = true;
o.ColorBehavior = LoggerColorBehavior.Enabled;
o.TimestampFormat = "HH:mm:ss ";
})
.SetMinimumLevel(LogLevel.Debug);
}).CreateLogger<NameScraper>();
}
}
}