Add clicking on MenuItem to open Twitch page

This commit is contained in:
Felix Förtsch
2019-01-03 19:55:17 +01:00
parent bb7561f9c3
commit a1331486a1

View File

@@ -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