Dim dtb1 As New DataTableBuilder("数据下载日期表")
dtb1.AddDef("日期", Gettype(Date))
dtb1.AddDef("下载", Gettype( Boolean ))
dtb1.Build()
MainTable= Tables("数据下载日期表")
Dim a As Integer
Dim b As Integer
Dim t As Integer
a = 1
b = 2
For t=1 To b
CurrentTable.AddNew()
CurrentTable.Current("日期")= Date.Today.AddDays(t-a)
Next
Dim dtb2 As New DataTableBuilder("老时时彩")
dtb2.AddDef("日期", Gettype(Date))
dtb2.AddDef("期号", Gettype(String), 32)
dtb2.AddDef("开奖号", Gettype(String), 32)
dtb2.AddDef("十位", Gettype(String), 32)
dtb2.AddDef("个位", Gettype(String), 32)
dtb2.AddDef("后三", Gettype(String), 32)
dtb2.Build()
MainTable= Tables("老时时彩")
Dim rw As Row
Dim StartDate As Date
Dim web As new System.Windows.Forms.WebBrowser
For Each rw In Tables("数据下载日期表").Rows
If rw("下载")=False Then
StartDate = rw("日期")
Dim y0 As String = StartDate.Year
Dim m0 As String = StartDate.Month
If m0.Length = 1 Then
m0.PadLeft(2,"0")
End If
Dim d0 As String = StartDate.Day
If d0.Length = 1 Then
d0.PadLeft(2,"0")
End If
Dim str As String = y0 & "-" & m0 & "-" & d0 & "_" & y0 & "-" & m0 & "-" & d0
str = "http://chart.cp.360.cn/kaijiang/kaijiang?lotId=255401&spanType=2&span=" & str
web.Navigate(str)
Do Until web.ReadyState = 4
Application.DoEvents
Loop
Dim i As Integer = 0
For Each dl As object In web.Document.GetElementById("his-tab").GetElementsByTagName("table")
If dl.getattribute("classname") Like "tr-odd*" Then
For Each tr As object In dl.GetElementsByTagName("tr")
Dim tds = tr.GetElementsByTagName("td")
If tds.count >= 5 AndAlso tds(0).Innertext > "" Then
Dim ndr As DataRow = DataTables("老时时彩").addnew
ndr("日期") = startDate
ndr("期号") = tds(0).innertext
ndr("开奖号") = tds(1).innertext
End If
Next
End If
Next
End If
Next