From 96377a58b431ce5411d3e75b2217e40a7439aea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Fri, 16 Feb 2024 18:34:24 +0900 Subject: [PATCH] =?UTF-8?q?routedetail.go=E3=81=8C=E5=BE=93=E3=81=86=20#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routedetail.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/routedetail.go b/src/routedetail.go index 6288eb2..a465c2e 100644 --- a/src/routedetail.go +++ b/src/routedetail.go @@ -83,18 +83,16 @@ func getRouteDetail(e *colly.HTMLElement) Route { onDivs = "div.routeDetail div.fareSection div.access" e.ForEach(onDivs, func (jf int, elf *colly.HTMLElement) { Fares.Stops = nil - if jf == j { - f := handleFare(elf, Fares, Stops) - Stations.Fares = append(Stations.Fares, f) - } + if jf != j { return } + f := handleFare(elf, Fares, Stops) + Stations.Fares = append(Stations.Fares, f) }) onDivs = "div.routeDetail div.walk ul.info" e.ForEach(onDivs, func (jw int, elw *colly.HTMLElement) { - if jw == j { - f := handleWalk(elw, Fares) - Stations.Fares = append(Stations.Fares, f) - } + if jw != j { return } + f := handleWalk(elw, Fares) + Stations.Fares = append(Stations.Fares, f) }) r.Stations = append(r.Stations, Stations) })