Dim TestMarkerID() As Int = Array As Int( _
4611, 4683, 4861, 11030, 39210, 47609, 47692, 47842, _
54765, 55618, 61452, 76532, 82400, 94232, 99733, 105653, _
110681, 115585, 132021, 138435, 140348, 143986, 144862, 160588, _
160821, 177500, 185190, 188068, 190190 _
)
For Each MarkerID As Int In TestMarkerID
Wait For(GetMarkerName(MarkerID)) Complete (MarkerName As String)
Log(MarkerID & " = """ & MarkerName & """")
Next
Sub GetMarkerName(MarkerID As Int) As ResumableSub
Dim dlh As HttpJob
dlh.Initialize("", Me)
Dim MarkerURL As String = "https://www.hmdb.org/m.asp?m=" & MarkerID
Dim WholePage As String = ""
dlh.Download(MarkerURL)
Wait For (dlh) JobDone(dlh As HttpJob)
If(dlh.Success) Then
WholePage = dlh.GetString2("Windows-1252")
End If
dlh.Release
If WholePage.Length <> 0 Then
Dim Temp As String = WholePage
Dim I As Int = Temp.ToUpperCase.IndexOf("<TITLE") 'Marker name is HTML title
If I >= 0 Then
Temp = Temp.SubString(I)
I = Temp.IndexOf(">")
If I >= 0 Then
Temp = Temp.SubString(I + 1) 'after the closing ">"
I = Temp.ToUpperCase.IndexOf("</TITLE")
If I >= 0 Then
Temp = Temp.SubString2(0, I)
'better do some basic tidy-ups ?
Temp = Temp.Replace("<U>", "").Replace("</U>", "").Replace("<u>", "").Replace("</u>", "")
Temp = Temp.Replace("<B>", "").Replace("</B>", "").Replace("<b>", "").Replace("</b>", "")
Temp = Temp.Replace("<I>", "").Replace("</I>", "").Replace("<i>", "").Replace("</i>", "")
Return Temp
End If
End If
End If
End If
Return "!!!" 'or some other indication that couldn't get marker name
End Sub