Jump to content

[Resolvido] Website meta tags [Urgente]


pbreda

Recommended Posts

Imagina que tens o site da google, este tem uma descrição que é colocada uma tag <Meta description="......> </Meta>.....bem o que quero é recuperar o valor do que está dentro da description sem usar o controlo webbrowser....ou seja....por HttpRequest acho que é isso.....

Qualquer coisa esfrega a lampada!!!Visite Banco de Software e desfrute do software disponível xD

Link to comment
Share on other sites

AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

agora entendi xD

tipo isto?

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim wb As New Net.WebClient
        Dim a As String
        a = wb.DownloadString("http://www.vbforums.com")
        Dim b() As String
        b = a.Split("<")
        Dim finalstring As New List(Of String)
        For i As Integer = 0 To b.Length - 1
            If b(i).Length >= 4 Then
                If b(i).Substring(0, 4).ToLower = "meta" Then
                    finalstring.Add(b(i))
                End If
            End If
        Next
        For i As Integer = 0 To finalstring.Count - 1
            If finalstring(i).ToLower.Contains("name=") Then
                MsgBox(Replace(midReturn("name=", " content=", finalstring(i)), """", ""))
                MsgBox(Replace(Replace(Replace(midReturn("content=", "", finalstring(i)), """", ""), "content=", ""), " />", ""))
            End If
        Next
    End Sub
    Public Function midReturn(ByVal first As String, ByVal last As String, ByVal total As String) As String
        Dim f_str As String = ""
        If last.Length < 1 Then
            f_str = total.Substring(total.IndexOf(first))
        End If
        If first.Length < 1 Then
            f_str = total.Substring(0, (total.IndexOf(last)))
        End If
        Try
            f_str = ((total.Substring(total.IndexOf(first), (total.IndexOf(last) - total.IndexOf(first)))).Replace(first, "")).Replace(last, "")
        Catch ArgumentOutOfRangeException As Exception

        End Try
        midReturn = f_str
    End Function
End Class
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.