Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 3rd, 2006, 03:46 PM
ehsanking ehsanking is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 207 ehsanking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 3 m 51 sec
Reputation Power: 4
Talking Help extracting dyanamic data from html code

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 songname" alt="Download songname"></a>
       &nbsp;songname
          </td>

Html part that holds artist name and album

Code:
::: Singer: <b>artistname</b> Album <b>albumename</b>::::</font></td>

Html part tha holdes artist image


Code:
<td>
      <br>
      <a href="http://localhost/ShowImage.asp?img=http://localhost/artistpic.jpg" 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


   If GetLine(RichTextBox1.Text, "../player/player.asp?id=", "')", sResult)  Then
  For n = LBound(sResult) To UBound(sResult)
    List1.AddItem sResult(n)   
  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

Reply With Quote
  #2  
Old May 7th, 2006, 02:57 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 57 m 26 sec
Reputation Power: 181
Just guessing, you may want to take a look at using the InternetExplorer object or WebBrowser control. These objects allow your code to use various html page objects without having to parse the page.

I haven't done much with this type of vb programming, so I could be way off base. You can find documentation in the Web Development section of the MSDN library.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Help extracting dyanamic data from html code


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT