diff --git a/LiquipediaMenu/MatchesAPI.swift b/LiquipediaMenu/MatchesAPI.swift index a056ce0..685c7a3 100644 --- a/LiquipediaMenu/MatchesAPI.swift +++ b/LiquipediaMenu/MatchesAPI.swift @@ -39,14 +39,16 @@ class MatchesAPI { var matches = [Match]() for match in matchString { + let score = try match.getElementsByClass("versus").text() let split = score.split(separator: ":") let leftscore = String(split[0]) let rightscore = String(split[1]) - + let newMatch = Match() newMatch.ongoing = true - newMatch.streamLink = "https://twitch.tv" + (match.getAttributes()?.get(key: "data-stream-twitch"))! + // TODO: Handle what happens when there is no twitch page. Currently it just opens Twicht main page. + newMatch.streamLink = try "https://twitch.tv/" + match.getElementsByClass("timer-object").attr("data-stream-twitch") newMatch.league = try match.select("tr > td > div > div > a").text() newMatch.team1name = try match.getElementsByClass("team-left").text() newMatch.team1score = leftscore