Compare commits
4 Commits
6f396c2090
...
03aab077d6
| Author | SHA1 | Date | |
|---|---|---|---|
| 03aab077d6 | |||
| 298cfa53d9 | |||
| 2e296f6d96 | |||
| ae3e70313c |
17
lottery-co-uk-scraper.core/Models/GameInformation.cs
Normal file
17
lottery-co-uk-scraper.core/Models/GameInformation.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace lottery_co_uk_scraper.core.Models
|
||||
{
|
||||
internal class GameInformation
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string GameName { get; set; }
|
||||
|
||||
public DayOfWeek DrawDay { get; set; }
|
||||
|
||||
public TimeOnly DrawClosing { get; set; }
|
||||
|
||||
public TimeOnly DrawOpening { get; set; }
|
||||
|
||||
public TimeOnly DrawTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,11 @@ using System.Text.RegularExpressions;
|
||||
|
||||
namespace lottery_co_uk_scraper.EuroMillions
|
||||
{
|
||||
internal class DrawNumber
|
||||
internal partial class DrawNumber
|
||||
{
|
||||
[GeneratedRegex(@"euromillions draw (\d+)")]
|
||||
private static partial Regex MyRegex();
|
||||
|
||||
public static int ProcessDrawNumberFromMeta(HtmlDocument doc, EurosResult eurosResult)
|
||||
{
|
||||
var metaKeywords = doc.DocumentNode.Descendants("meta")
|
||||
@@ -15,7 +18,7 @@ namespace lottery_co_uk_scraper.EuroMillions
|
||||
if (metaKeywords != null)
|
||||
{
|
||||
var keywordsText = metaKeywords.GetAttributeValue("content", "");
|
||||
var drawNumberMatch = Regex.Match(keywordsText, @"euromillions draw (\d+)");
|
||||
var drawNumberMatch = MyRegex().Match(keywordsText);
|
||||
|
||||
if (drawNumberMatch.Success)
|
||||
{
|
||||
|
||||
@@ -194,15 +194,16 @@ namespace lottery_co_uk_scraper.NationalLottery
|
||||
try
|
||||
{
|
||||
var bonusBallNode = ballsDrawn.Descendants("span")
|
||||
.FirstOrDefault(x => x.HasClass(ballClass));
|
||||
.FirstOrDefault(x => x.HasClass(ballClass));
|
||||
|
||||
if (bonusBallNode != null && int.TryParse(bonusBallNode.InnerText, out int bonusBall))
|
||||
{
|
||||
return bonusBall;
|
||||
}
|
||||
_logger.LogError("Failed to parse {className} value: {x.InnerText}", ballClass, x.InnerText);
|
||||
|
||||
throw new Exception($"Failed to parse {ballClass} value: {x.InnerText}");
|
||||
_logger.LogError("Failed to parse {className}", ballClass);
|
||||
|
||||
throw new Exception($"Failed to parse {ballClass}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -21,4 +21,11 @@
|
||||
<ProjectReference Include="..\lottery-co-uk-scraper.data\lottery-co-uk-scraper.data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="EuroMillions\" />
|
||||
<Folder Include="NationalLottery\" />
|
||||
<Folder Include="SetForLife\" />
|
||||
<Folder Include="Thunderball\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user