#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private js As jSoup
Private Ciclo As List
Private Extract01 As List
Private Extract02 As List
Private Extract03 As List
Private Extract04 As List
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
Extract01.Initialize
Extract02.Initialize
Extract03.Initialize
Extract04.Initialize
ScrapeTable
#IF B4A
Activity.Finish
#End If
#if B4J
ExitApplication ' ends the program
#End If
End Sub
Private Sub ScrapeTable
Dim url As String = "https://www.superenalotto.com/archivio"
Dim HTML As String = js.connect(url)
Dim FirstDateRow As String = js.getElementsByClass(HTML, "t1").Get(0)
Extract01 = js.selectorElementText(FirstDateRow, "a")
Dim Count As Int = Extract01.Size
Log("Count: "& Count)
Dim Totclicli As String = js.getElementsByClass(HTML, "t1").Get(0)
Ciclo = js.selectorElementText(Totclicli, "a")
Dim CountCiclo As Int = Ciclo.Size
Log("Count: "& CountCiclo)
For w=0 To CountCiclo-1
Log("Extract01: "& Extract01.Get(w))
Log("xxxxxxxxxxxxxxxxx nuovo giro " & (w+1) & " xxxxxxxxxxxxxxxxxxxx")
Dim FirstTableRow As String = js.getElementsByClass(HTML, "t2").Get(w)
Extract02 = js.getElementsByClass(FirstTableRow, "ball-24px")
Extract03 = js.getElementsByClass(FirstTableRow, "jolly-24px")
Extract04 = js.getElementsByClass(FirstTableRow, "superstar-24px")
Dim columns As List
columns.Initialize
Dim x As Int = 0
For i = 0 To Extract02.Size -1
columns = js.selectorElementText($"<table>${Extract02.Get(i)}</table>"$, "td")
For j = 0 To columns.Size -1
x = x + 1
Log($"Number${x}: ${columns.Get(j)}"$)
Next
Next
For i = 0 To Extract03.Size -1
columns = js.selectorElementText($"<table>${Extract03.Get(i)}</table>"$, "td")
For j = 0 To columns.Size -1
x = x + 1
Log($"Jolly Number${x}: ${columns.Get(j)}"$)
Next
Next
For i = 0 To Extract04.Size -1
columns = js.selectorElementText($"<table>${Extract04.Get(i)}</table>"$, "td")
For j = 0 To columns.Size -1
x = x + 1
Log($"Super Number${x}: ${columns.Get(j)}"$)
Next
Next
Next
End Sub