Help extracting dyanamic data from html code

Joined
Jun 30, 2005
Messages
59
Reaction score
0
Hi all:

I got a html code that i used inet.openURL to put it in textbox. Now i want to extract Artistname , albumname,songname,artistpic from it. The code already extracts song ids but i want to output songname and other informatin with it. I be happy if an expert show me an easy way to extract those data.Thanks

Note: in one page there is one album for single artist but mutliple songnames
Note: the bold parts are dynamaic and changing and i want extract them

These blocks of html are amoung othe codes that i removed them in mypost
html part that holds each song name:



Code:
<img border="0" src="../images/download.gif" width="16" height="16" longdesc="Download [b]songname[/b]" alt="Download [b]songname[/b]"></a>
	   &nbsp;[b]songname[/b]
		  </td>
Html part that holds artist name and album

Code:
::: Singer: <b>[b]artistname[/b]</b> Album <b>[b]albumename[/b]</b>::::</font></td>
Html part tha holdes artist image


Code:
<td>
	  <br>
	  <a href="[url="http://localhost/ShowImage.asp?img=http://localhost/"]http://localhost/ShowImage.asp?img=http://localhost/[/url][b]artistpic.jpg[/b]" target=_blank>
	  <img border="0" src="../CdImages/artistpic.jpg" width="180" height="180" longdesc="Click here to Enlarge" alt="Click here to Enlarge" >
	  </a>
	</td>


Code:
Private Sub Command1_Click(Index As Integer)

Select Case Index
 Case 0:
  If txtURL.Text <> "" Then
   RichTextBox1.Text = Inet1.OpenURL(txtURL.Text, icString)
  End If
 
 Case 1:
  End
End Select
End Sub


Private Sub Command2_Click()
 Dim sResult() As String, n As Long


   [b]If GetLine(RichTextBox1.Text, "../player/player.asp?id=", "')", sResult) [/b] Then
  For n = LBound(sResult) To UBound(sResult)
   [b] List1.AddItem sResult(n)[/b]   
  Next n
  
Else
  ' No occurances were found
 End If
End Sub

 


Private Function GetLine(ByVal sText As String, ByVal sStart As String, ByVal sEnd As String, ByRef sArr() As String) As Boolean
 Dim lPos As Long, lEnd As Long, lCount As Long, sTemp() As String
 
 ReDim sTemp(100)
 
 lPos = InStr(1, sText, sStart, vbTextCompare)
 Do While lPos
  lEnd = InStr(lPos, sText, sEnd, vbTextCompare)
  If lEnd Then
  
   sTemp(lCount) = Mid$(sText, lPos, lEnd - lPos)
   lPos = InStr(lEnd, sText, sStart, vbTextCompare)
  Else
   sTemp(lCount) = Mid$(sText, lPos)
   lPos = 0
  End If
  lCount = lCount + 1
  If lCount > UBound(sTemp) Then ReDim Preserve sTemp(100 + lCount)
 Loop

 If lCount > 0 Then
  ReDim Preserve sTemp(lCount - 1)
  sArr = sTemp
 End If
 GetLine = lCount
End Function
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top