reverse ordering back to normal
This commit is contained in:
+3
-5
@@ -29,12 +29,10 @@ impl Extractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_departures<'a>(&'a self, html: &'a Html) -> impl Iterator<Item = ElementRef> {
|
pub(crate) fn get_departures<'a>(&'a self, html: &'a Html) -> impl Iterator<Item = ElementRef> {
|
||||||
// `Select` does not implement DoubleEndedIterator, so we need to collect it first
|
let result: Vec<_> = html.select(&self.departure).collect();
|
||||||
let mut result = html.select(&self.departure).collect::<Vec<_>>();
|
|
||||||
result.reverse();
|
|
||||||
// we seem to extract the blocks twice with slightly different layout, so we discard half of them
|
// we seem to extract the blocks twice with slightly different layout, so we discard half of them
|
||||||
result.truncate(result.len() / 2);
|
let half = result.len() / 2;
|
||||||
result.into_iter()
|
result.into_iter().take(half)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_transport_line(departure_block: scraper::ElementRef) -> Result<&str> {
|
pub(crate) fn get_transport_line(departure_block: scraper::ElementRef) -> Result<&str> {
|
||||||
|
|||||||
Reference in New Issue
Block a user