Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Get row from AngleSharp.Dom.Html.HtmlSpanElement

Get row from AngleSharp.Dom.Html.HtmlSpanElement

Scheduled Pinned Locked Moved C#
htmlhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 12121758
    wrote on last edited by
    #1

    Hello everyone. I'm currently trying to get into htmls and as a start wanted to create a program which reads the current Artist and song out of a Webradio. So far i can read out an Artist and song but it's not the current one but the last one in the list on the site...could anyone help me getting the current one? That'd be great. :) Here is my Code so far:

    using (WebClient client = new WebClient())
    {

                string htmlCode = client.DownloadString("http://www.planetradio.de/music/trackfinder.html");
                
                var parser = new HtmlParser();
                var document = parser.Parse(htmlCode);
                
                
                var hitfinderTable = document.All.Where(m => m.Id == "hitfindertable").First() as AngleSharp.Dom.Html.IHtmlTableElement;
    
                foreach (var row in hitfinderTable.Rows)
                {
                    var artistName = row.Cells\[2\].TextContent;
                    var songName = row.Cells\[3\].TextContent;
                    
                    label.Content = artistName + " " + songName;
                    
                }
            }
    

    Thanks to everyone in advance.

    L 1 Reply Last reply
    0
    • U User 12121758

      Hello everyone. I'm currently trying to get into htmls and as a start wanted to create a program which reads the current Artist and song out of a Webradio. So far i can read out an Artist and song but it's not the current one but the last one in the list on the site...could anyone help me getting the current one? That'd be great. :) Here is my Code so far:

      using (WebClient client = new WebClient())
      {

                  string htmlCode = client.DownloadString("http://www.planetradio.de/music/trackfinder.html");
                  
                  var parser = new HtmlParser();
                  var document = parser.Parse(htmlCode);
                  
                  
                  var hitfinderTable = document.All.Where(m => m.Id == "hitfindertable").First() as AngleSharp.Dom.Html.IHtmlTableElement;
      
                  foreach (var row in hitfinderTable.Rows)
                  {
                      var artistName = row.Cells\[2\].TextContent;
                      var songName = row.Cells\[3\].TextContent;
                      
                      label.Content = artistName + " " + songName;
                      
                  }
              }
      

      Thanks to everyone in advance.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I don't see anywhere where you are "sorting"; you're just lazy-loading "a list" and asking for the first entry (regardless of order). You're also not "appending" to "label.Content" ... if that's what's on your mind.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups