Add LinkName to stations when querying a train
This commit is contained in:
parent
dd273558e4
commit
5785e4a98b
2 changed files with 562 additions and 555 deletions
|
@ -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; }
|
||||||
|
|
|
@ -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…
Add table
Reference in a new issue