Better scraping of multiplayer counts from PCGamingWiki

dashboard
Pat Hartl 2023-01-15 19:00:27 -06:00
parent 3c7b8f90ee
commit a0e15514e3
1 changed files with 10 additions and 3 deletions

View File

@ -56,13 +56,20 @@ namespace LANCommander.PCGamingWiki
if (multiplayerTable == null)
return null;
var multiplayerRows = multiplayerTable.SelectNodes(".//tr[contains(@class, 'table-network-multiplayer-body-row')]");
var multiplayerAbbrs = multiplayerTable.SelectNodes(".//abbr");
var multiplayerCounts = multiplayerTable.SelectNodes(".//td[contains(@class, 'table-network-multiplayer-body-players')]");
for (int i = 0; i < multiplayerAbbrs.Count; i++)
foreach (var row in multiplayerRows)
{
var type = multiplayerAbbrs[i].InnerText;
var players = multiplayerCounts[i].InnerText;
var abbr = row.SelectNodes(".//abbr");
var count = row.SelectNodes(".//td[contains(@class, 'table-network-multiplayer-body-players')]");
if (abbr == null || count == null)
continue;
var type = abbr[0].InnerText;
var players = count[0].InnerText;
int playerCount = 0;