Results 1 to 4 of 4

Thread: Extract text from html source

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2008
    Posts
    18

    Extract text from html source

    i am trying to extract some usernames from a website. normally i dont have a problem and but cant get it to work...here is the code i normally use

    For Each temp As HtmlElement In WebBrowser1.Document.Links
    Dim str As String = Nothing
    str = temp.GetAttribute("href")
    If str.Contains("profile") Then
    Dim x() As String
    x = str.Split("=")
    ListBox1.Items.Add(x(1))
    End If
    str = Nothing
    Next

    but this is the html code i want to get from

    <a href="http://help.com/?status=@astradamasta%20&in_reply_to_status

    how would i go about getting the user which is astradamasta

    thanks in advance

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Extract text from html source

    The best thing is you can go for is RegularExpression.. But you have to more brief about the input data
    Please mark you thread resolved using the Thread Tools as shown

  3. #3
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Extract text from html source

    When asking things like this it's always good to say what is going to be consistent in the text you are extracting. Will it always be "<a href="http://help.com/?status=@thename&#37;20&in_reply_to_status"? If so, and you want to use your string splitting you could do this:

    vb.net Code:
    1. Dim str As String = "<a href=""http://help.com/?status=@astradamasta%20&in_reply_to_status".Split("@"c, "%"c)(1)
    Last edited by ForumAccount; May 12th, 2009 at 01:04 AM.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Nov 2008
    Posts
    18

    Re: Extract text from html source

    thanks this work

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width