Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3314018
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:10:58+00:00 2026-05-17T22:10:58+00:00

I am using the agility pack to do some screens scraping and my code

  • 0

I am using the agility pack to do some screens scraping and my code so far to get titles is:

foreach (HtmlNode title in root.SelectNodes("//html//body//div//div//div[3]//div//div//div//div[3]//ul//li[1]//h4"))
        {
            string titleString = "<div class=\"show\">" + title.InnerText + "</div>";
            shows.Add(titleString);
        }

Before the title I want a timestamp related to the title and it has the node

/html/body/div/div/div[3]/div/div/div/div[3]/ul/li[1]/ul/li/span

How can I get this value next to the title? So something like:

string titleString = "<div class=\"show\">" + time.InnerText + " - " + title.InnerText + "</div>";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:10:59+00:00Added an answer on May 17, 2026 at 10:10 pm

    Try to get the parent node first and then get both title and timestamp from the parent

            HtmlNodeCollection TvGuideCollection = doc.DocumentNode.SelectNodes(@"//ul[@class='results']//ul//li");
            List<string> shows = new List<string>();
            foreach (HtmlNode item in TvGuideCollection)
            {
                HtmlNode title = item.SelectSingleNode(".//a");
                HtmlNode time = item.SelectSingleNode(".//span[@class='stamp']");
                if (title != null && time != null)
                {
                    string titleString = "<div class=\"show\">" + time.InnerText + " - " + title.InnerText + "</div>";
                    shows.Add(titleString);
                }
            }
    

    Updated to just get todays shows

                HtmlNode TvGuideToday = doc.DocumentNode.SelectSingleNode(@"//ul[@class='results']//ul");
                List<string> shows = new List<string>();
                foreach (HtmlNode item in TvGuideToday.SelectNodes(".//li")) 
                {
                    HtmlNode title = item.SelectSingleNode(".//a");
                    HtmlNode time = item.SelectSingleNode(".//span[@class='stamp']");
                    if (title != null && time != null)
                    {
                        string titleString = "<div class=\"show\">" + time.InnerText + " - " + title.InnerText + "</div>";
                        shows.Add(titleString);
                    }
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using .NET 3.5 (C#) and the HTML Agility Pack to do some web
I am using html agility pack to parse html tabular information . Now there
I want to parse the html table using html agility pack. I want to
I'm currently using the HTML Agility Pack in C# for a web crawler. I've
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I have some HTML, eg: <%@ Page Title=About Us Language=C# MasterPageFile=~/Site.master AutoEventWireup=true CodeBehind=ContentManagedTargetPage.aspx.cs Inherits=xxx.ContentManagedTargetPage
When using Firebug or some of the bookmarklets: javascript:(function(){var a=document.createElement(script);a.setAttribute(src,http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js);if(typeof jQuery==undefined){document.getElementsByTagName(head)[0].appendChild(a)}(function(){if(typeof jQuery==undefined){setTimeout(arguments.callee,100)}else{jQuery(*).one(click,function(d){jQuery(this)[0].scrollIntoView();for(var e=,c=jQuery(this)[0];c&&c.nodeType==1;c=c.parentNode){var b=jQuery(c.parentNode).children(c.tagName).index(c)+1;b>1?(b=[+b+]):(b=);e=/+c.tagName.toLowerCase()+b+e}window.location.hash=#xpath:+e;prompt('Twoje
Using online interfaces to a version control system is a nice way to have
Using PyObjC , you can use Python to write Cocoa applications for OS X.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.