extracting innertext from multiple<span> tag from the same <li> tag RRS feed

  • Question

  • Hello, i want to extract after navigation the innertext of the <span> tag  but it is very difficult because it comes a a full list but i want to extract it one by one and then put it in a listview...


    </li><li class="video-list-item related-list-item "> <div class="content-wrapper"> <a href="https://www.youtube.com/watch?v=94Rq2TX0wj4" class="content-link spf-link yt-uix-sessionlink" rel="spf-prefetch" title="Martin Solveig &amp; GTA - Intoxicated (Official Music Video)" data-sessionlink="ei=VDvNVJ-XI6a3-APo7YDYBw&amp;feature=relmfu&amp;ved=CAYQzRooAw"> <span dir="ltr" class="title" aria-describedby="description-id-785839"> Martin Solveig &amp; GTA - Intoxicated (Official Music Video) </span> <span class="accessible-description" id="description-id-785839"> - Duration: 3:15. </span> <span class="stat attribution"> <span class="g-hovercard" data-ytid="UCpDJl2EmP7Oh90Vylx0dZtA" data-name="relmfu"> by <span class=" g-hovercard" data-ytid="UCpDJl2EmP7Oh90Vylx0dZtA" data-name="">Spinnin' Records</span> </span> </span> <span class="stat view-count">1,097,934 views</span> </a> </div>

    MY CODE:

     Dim dc As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("li")
            For Each jg As HtmlElement In dc
                Dim kl As String = jg.OuterHtml
                If kl.Contains("yt-uix-scroller-scroll-unit") Then

                    Dim kd As HtmlElementCollection = jg.GetElementsByTagName("a")
                    For Each kw As HtmlElement In kd
                        Dim kkCOLLECTION As HtmlElementCollection = kw.GetElementsByTagName("span")
                            Dim dd As String = jg.GetAttribute("data-video-title")
                            Dim LinKi As String = kw.GetAttribute("href")
                            Dim kbv As String = LinKi.Remove(43)
                        Dim View_upld As String = kkCOLLECTION(1).InnerText
                            For Each nn As String In pl
                                For Each nnn As String In pll
                                    For Each nnnn As String In plll
                                        Dim lvi As New ListViewItem
                                        lvi.Text = (dd & vbCrLf)
                                        lvi.SubItems.Add(View_upld & vbCrLf)
                                        lvi.SubItems.Add(kbv & vbCrLf)

    it seems i am doing it wrong. i want it to extract the innertext of each span so i can put it in the listview cells.

    Please, this is very important as its a project i am working on.

    Saturday, February 28, 2015 9:00 AM

All replies