Skip to content

Commit 657f668

Browse files
authored
Merge pull request #1 from suchapalaver/fix/workspace-definition
Fix workspace definition ✅
2 parents c0abb2f + cf1d351 commit 657f668

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[workspace]
2-
workspace.resolver = "2"
2+
resolver = "2"
33
members = ["scraper", "airbnb"]

airbnb/src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
use serde::Serialize;
12
use std::error::Error;
23
use std::thread;
34
use std::time::Duration;
4-
use thirtyfour::{prelude::{WebDriverError, ElementWaitable}, By, DesiredCapabilities, WebDriver, WebElement};
5+
use thirtyfour::{
6+
prelude::{ElementWaitable, WebDriverError},
7+
By, DesiredCapabilities, WebDriver, WebElement,
8+
};
59
use url::Url;
6-
use serde::Serialize;
710

811
pub async fn scrape_airbnb(place: &str) -> Result<(), Box<dyn Error>> {
912
let driver = initialize_driver().await?;
@@ -33,15 +36,15 @@ async fn scrape_all(driver: WebDriver) -> Result<(), Box<dyn Error>> {
3336

3437
match next_page_button.is_clickable().await? {
3538
true => {
36-
39+
3740
//start extracting data
38-
41+
3942
let house_elems = get_house_elements(&driver).await?;
4043

4144
for house_elem in house_elems {
4245

4346
let bnb_details = BnbDetails::from(house_elem).await?;
44-
47+
4548
wtr.serialize(bnb_details)?;
4649

4750
}
@@ -69,7 +72,6 @@ async fn load_next_page(
6972
next_page_button: WebElement,
7073
driver: &WebDriver,
7174
) -> Result<(), Box<dyn Error>> {
72-
7375
next_page_button.click().await?;
7476
thread::sleep(Duration::from_secs(2));
7577

scraper/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::error::Error;
22

33
#[tokio::main]
4-
async fn main() -> Result<(),Box<dyn Error>>{
4+
async fn main() -> Result<(), Box<dyn Error>> {
55
airbnb::scrape_airbnb("Rome").await?;
66
Ok(())
7-
}
7+
}

0 commit comments

Comments
 (0)