Browse Source

Add LinkName to stations when querying a train

master
Kenneth Bruen 2 years ago
parent
commit
5785e4a98b
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 2
      scraper/src/Models/Train.cs
  2. 5
      scraper/src/Scrapers/Train.cs

2
scraper/src/Models/Train.cs

@ -44,6 +44,7 @@ namespace InfoferScraper.Models.Train {
public interface ITrainStopDescription { public interface ITrainStopDescription {
public string Name { get; } public string Name { get; }
public string LinkName { get; }
public int Km { get; } public int Km { get; }
/// <summary> /// <summary>
@ -170,6 +171,7 @@ namespace InfoferScraper.Models.Train {
internal record TrainStopDescription : ITrainStopDescription { internal record TrainStopDescription : ITrainStopDescription {
private List<ITrainStopNote> ModifyableNotes { get; } = new(); private List<ITrainStopNote> ModifyableNotes { get; } = new();
public string Name { get; set; } = ""; public string Name { get; set; } = "";
public string LinkName { get; set; } = "";
public int Km { get; set; } public int Km { get; set; }
public int? StoppingTime { get; set; } public int? StoppingTime { get; set; }
public string? Platform { get; set; } public string? Platform { get; set; }

5
scraper/src/Scrapers/Train.cs

@ -153,6 +153,11 @@ namespace InfoferScraper.Scrapers {
.QuerySelectorAll(":scope > div")[0] .QuerySelectorAll(":scope > div")[0]
.Text() .Text()
.WithCollapsedSpaces(); .WithCollapsedSpaces();
stopDescription.LinkName = new Flurl.Url(stopDetails
.QuerySelectorAll(":scope > div")[0]
.QuerySelector(":scope a")
.Attributes["href"]
.Value).PathSegments.Last();
var scrapedKm = stopDetails var scrapedKm = stopDetails
.QuerySelectorAll(":scope > div")[1] .QuerySelectorAll(":scope > div")[1]
.Text() .Text()

Loading…
Cancel
Save